Check to see if date is = to Sunday

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top