Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,560
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,560
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
Date format issue CindyLF1 New Users to Excel 3 June 12th 06 06:18 PM
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
How can i use a command button to validate date and time kcdonaldson Excel Discussion (Misc queries) 0 December 9th 05 04:03 PM
Another Date issue. TimM Excel Worksheet Functions 1 November 17th 05 01:58 AM


All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"