Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Get Day from Date to Validate
I am trying to ensure that the user enters the first day of the month when
prompted, so I need to test the day from the date entered. The month and year do not matter. Thanks! Here is what I have, but it does not work: myDate = InputBox(Prompt:="Enter the FIRST DAY of the Month you want to Create", _ Default:=Format(Date, "mm/dd/yy")) DayDate = myDate(Day) '(THIS IS WHERE THE PROBLEM IS) If DayDate < 1 Then Msg = " You Did Not Enter The First Day of The Month" & Chr(10) & _ " Are You SURE You Want To Continue?" Ans = MsgBox(Msg, vbYesNo) If Ans = vbNo Then Exit Sub End If |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Get Day from Date to Validate
DayDate = Day(myDate) HTH "David" wrote: I am trying to ensure that the user enters the first day of the month when prompted, so I need to test the day from the date entered. The month and year do not matter. Thanks! Here is what I have, but it does not work: myDate = InputBox(Prompt:="Enter the FIRST DAY of the Month you want to Create", _ Default:=Format(Date, "mm/dd/yy")) DayDate = myDate(Day) '(THIS IS WHERE THE PROBLEM IS) If DayDate < 1 Then Msg = " You Did Not Enter The First Day of The Month" & Chr(10) & _ " Are You SURE You Want To Continue?" Ans = MsgBox(Msg, vbYesNo) If Ans = vbNo Then Exit Sub End If |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Get Day from Date to Validate
Thank you VERY much!
That did it.. :) "Toppers" wrote: DayDate = Day(myDate) HTH "David" wrote: I am trying to ensure that the user enters the first day of the month when prompted, so I need to test the day from the date entered. The month and year do not matter. Thanks! Here is what I have, but it does not work: myDate = InputBox(Prompt:="Enter the FIRST DAY of the Month you want to Create", _ Default:=Format(Date, "mm/dd/yy")) DayDate = myDate(Day) '(THIS IS WHERE THE PROBLEM IS) If DayDate < 1 Then Msg = " You Did Not Enter The First Day of The Month" & Chr(10) & _ " Are You SURE You Want To Continue?" Ans = MsgBox(Msg, vbYesNo) If Ans = vbNo Then Exit Sub End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert date | Excel Worksheet Functions | |||
Date format issue | New Users to Excel | |||
Need to Improve Code Copying/Pasting Between Workbooks | Excel Discussion (Misc queries) | |||
How can i use a command button to validate date and time | Excel Discussion (Misc queries) | |||
Another Date issue. | Excel Worksheet Functions |