Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inputbox: Date Type?

Status
Not open for further replies.

Eytch

Programmer
Jan 29, 2003
60
US
I want to have the user enter a date to an input box in the format "01/01/05".

Set myDate = Application.InputBox(prompt:="Enter the first day of the Month, mm/01/yy", Type:=0 + 1 + 2)

Can anyone tell me the Type setting to use so that I may assign the value input to a cell as the myDate value? 0 + 1 + 2 doesn't work.

Thanks,
Lakefish
 
Code:
Set myDate = CDate(Application.InputBox(prompt:="Enter the first day of the Month, mm/01/yy", Type:=2))
If want to validate the input before continuing
Code:
Do
   myDate = Application.InputBox(prompt:="Enter the first day of the Month, mm/01/yy", Type:=2)
Loop Until IsDate(myDate) 'Assumes myDate is not declared as date
myDate = CDate(myDate)

Hope this helps,
CMP

Instant programmer, just add coffee.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top