Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
input box for a date -- how to make an enter key the current date by default
thanks for all your help -- i have a macro that has an input box that requires a date. is there a way to make the current date the input if the user just hits ENTER without typing a date? Currently, if the user just hits enter, the macro crashes. thanks again, JasonK |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
input box for a date -- how to make an enter key the current date
Jason, try the below
Sub Macro1() Dim dtTemp As Date varDate = InputBox("Enter Date", , Format(Date, "dd-mmm-yyyy")) If IsDate(varDate) Then dtTemp = varDate Else dtTemp = Date MsgBox dtTemp End Sub If this post helps click Yes --------------- Jacob Skaria "JasonK" wrote: thanks for all your help -- i have a macro that has an input box that requires a date. is there a way to make the current date the input if the user just hits ENTER without typing a date? Currently, if the user just hits enter, the macro crashes. thanks again, JasonK |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
input box for a date -- how to make an enter key the current date
Jacob,
that worked perfectly. thank you. JasonK On Sat, 18 Jul 2009 01:12:01 -0700, Jacob Skaria wrote: Jason, try the below Sub Macro1() Dim dtTemp As Date varDate = InputBox("Enter Date", , Format(Date, "dd-mmm-yyyy")) If IsDate(varDate) Then dtTemp = varDate Else dtTemp = Date MsgBox dtTemp End Sub If this post helps click Yes --------------- Jacob Skaria "JasonK" wrote: thanks for all your help -- i have a macro that has an input box that requires a date. is there a way to make the current date the input if the user just hits ENTER without typing a date? Currently, if the user just hits enter, the macro crashes. thanks again, JasonK |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to make the current date appear when i click 'enter' in a cell | Excel Worksheet Functions | |||
Make date change in excel to current date when opening daily? | Excel Discussion (Misc queries) | |||
How do I enter a date range ie -7 from current date in MS QUERY | Excel Discussion (Misc queries) | |||
Can I automatically enter the current date or current time into a | New Users to Excel | |||
enter a current date in a cell? | Excel Discussion (Misc queries) |