Message box after a date is selected

jimbowvu80s

New Member
Joined
Jan 6, 2009
Messages
22
I'm trying to have a message box popup if a user enters a date that is a Monday (or if they move off of the cell). Currently, I have a calendar that popus when the field is selected, but the user can bypass the calendar and enter the date manually.

I can't figure out how to pull Monday out of the date. The cell is currently formated to show March 19, 2009. Here's what I've been using.

Thank you

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(False, False) = "C3:E3" Then
Call OpenCalendar
End If

If Cells(3, 3).Value = vbMonday Then
MsgBox ("Today is Monday - Did you do a Safety Report")
End If


End Sub
---
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try

Code:
If WorksheetFunction.Weekday(Cells(3, 3), 2) = 1 Then
MsgBox ("Today is Monday - Did you do a Safety Report")
End If
 
Upvote 0
Bearing in mind that message box will pop up every time the user moves cells, since the value in C3 will still be a MOnday. Maybe your Calendar popup belongs in the Worksheet_SelectionChange event, but maybe your Monday test belongs in the Worksheet_Change event?
 
Upvote 0
Thanks for the information, but that's kind of a bummer that it appears when you click on other fields when it's Monday. Will the worksheet_change event stop that? I do have a worksheet change already in that worksheet. This procedure checks for capitalization in a couple cells. Is it possible to have two Worksheet_Changes?

--partial code
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then
Exit Sub
End If
On Error GoTo ErrHandler:
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top