MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Does Inputbox accept dates?

Posted by Fred on February 12, 2001 11:19 AM

Hi everybody,

I am new to this board and found it while i was searching for some codes in the net, hope i can find an answer.

What I would like to do is;
When someones open an excel file, a macro has to start without pressing a button this is the first thing, and the user will input 2 dates (1:starting and 2:end date -for a report-). The macro can write these values into a cell in this workbook that is no problem they will be hidden and locked.

The problem is I would like the user to select the date from some kind of a calendar like when you doubleclick the time in the right bottom of windows bar. If it's not possible, i want the user to enter the date in the correct format (like data entry in MS Access) or at least the user must enter 2 dates at one inputbox.

Thanks to anyone who could help...


Posted by Tom Morales on February 12, 2001 11:29 AM

I have to defer the question on pop-up calendars to those wiser than I. Insofar as the formating of date inputs, it won't matter what format the user puts into the input box, provided you've established the desired date format in the cell that the information will go to. Alternately, you can rite the date format into your macro. Look up the example in "Format Function" in Excel VBA help.

Posted by Celia on February 12, 2001 4:01 PM

If you send me your address, I'll send you a workbook containing what I think you're looking for.

Posted by Dave Hawley on February 13, 2001 4:36 AM

Hi Fred

Excel has a "Calendar control" as part of it's toolbox. To see it you will need to right click on the "Toolbox" while in the VBE and select "Additional Controls" then scroll down to: Calendar Control 9.0 if Excel 2000 or 8.0 if 97. Place this control on a UserForm and size as needed. They are pretty easy to use. I ALWAYS use them when gettin a date from users.

Any probs jsut yell!OzGrid Business Applications