Yes and No MsgBox when the date is the same as today.

KyleJackMorrison

Board Regular
Joined
Dec 3, 2013
Messages
107
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
I have a list of names in cells A1:A10
I also have a list of dates in B1:B10 which are course dates (Formated 12-May-16)

What i'm struggling to do is create a MsgBox to pop up if today's date is in column B.

I would like the box to say "Did <name> pass this course?".

If yes, it would colour the cell Green and keep the date in there.

If no it would colour the cell Red and keep the date in there.

Any help would be much appreciated

Regards,
Kyle
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
When should the message pop up? Will it be for a single record, or will it spin through each record, and pop up a message repeatedly until each record has been covered?

The basics are:

To create a Yes No pop-up, and trap the result:
Code:
Dim msgResult   As VbMsgBoxResult


msgResult = MsgBox(Prompt:="your_message", Buttons:=vbYesNo + vbQuestion, Title:="your_title")

To handle the result:
Code:
If msgResult = vbYes Then
    'do this
Else
    'do that
End If

To change a cell fill color:
Code:
Range("A1").Interior.ColorIndex = 3 'red
 
Upvote 0
Jon von der Heyden :

Thank you!

The data will be already inputted on the sheet. So if possible i would like the code to either search when the sheet gets activated, or search after new data has been entered.

Here is the tricky part:!

If the code searches the date, finds the date, and colours it either yes or no. But i don't want it popping up with the same message everytime i re enter data or click the sheet.

Is there a way to have the MsgBox pop up only once.

Regards,
Kyle
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

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