Input Box default value as a date
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) |
Input Box default value as a date
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 HIS "Dan" wrote in message ... 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) |
Input Box default value as a date
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 "Dan" wrote in message ... 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) . |
All times are GMT +1. The time now is 08:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com