Input Box default value as a date

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

1. I want my InputBox to have a default value of a
date,NOW but i keep getting a TYPE mismatch error. 2. I
would like the same as #1 but NOW +90 (days).
This is what I have:
Dim StartDate As Date
#1 StartDate = InputBox("Words", "Title", Now(),2)

#2 EndDate = InputBox("Words", "Title", Now()+90,2)
 
Dan

This works...change the format to your locale

Sub Test()
Dim StartDate As String
Dim EndDate As String
StartDate = InputBox("Words", "Title", Format(Date, "dd/mm/yyyy"))
EndDate = InputBox("Words", "Title", Format(Date + 90, "dd/mm/yyyy"))
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thanks Nick.

-----Original Message-----
Dan

This works...change the format to your locale

Sub Test()
Dim StartDate As String
Dim EndDate As String
StartDate = InputBox("Words", "Title", Format (Date, "dd/mm/yyyy"))
EndDate = InputBox("Words", "Title", Format(Date + 90, "dd/mm/yyyy"))
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top