ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check to see if date is = to Sunday (https://www.excelbanter.com/excel-programming/364642-check-see-if-date-%3D-sunday.html)

Brian

Check to see if date is = to Sunday
 
I want to prompt the user if the date he entered is not a Sunday. It
might not be the Sunday in the current week but any Sunday. Is this
possible in VBA?


Thanks in advance

Brian


Paul B

Check to see if date is = to Sunday
 
Brian, here is one way,

Sub test()
If Weekday(Range("A1"), vbSunday) = 1 Then
'*****if its a Sunday
MsgBox "this is a Sunday"
Else
'*****If not a Sunday
MsgBox "this is Not a Sunday"
End If
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Brian" wrote in message
ups.com...
I want to prompt the user if the date he entered is not a Sunday. It
might not be the Sunday in the current week but any Sunday. Is this
possible in VBA?


Thanks in advance

Brian





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com