PDA

View Full Version : Checking date in cell A1 Monday or not



priya123
04-10-2007, 01:43 PM
Hi Is there any way through VBA that I can check whether the date in cell A2 is Monday or not.

Also the code should allow me to continue if its Monday else should promt a message saying that its not Monday and whether the user still wants to continue. If no it should terminate if yes the next part of the code should continue.

Am trying to do something with this... but unaware as to how to do that .

Any ideas....

mdmackillop
04-10-2007, 02:06 PM
Sub Monday()
If Weekday(Range("A1")) = vbMonday Then
MsgBox "It's Monday!!!"
Else
If MsgBox("Not a Monday. Continue?", vbYesNo) = vbYes Then
Continuing
Else
Exit Sub
End If
End If
End Sub

Sub Continuing()
MsgBox "Doing more stuff"
End Sub

priya123
04-10-2007, 02:51 PM
Thanks a lot. I would try the code and will let you know the results. Thanks again.