MsgBox if day = saturday

G

Guest

Guest
Hi there,
Please help me write a macro to do the following:
I need a message box to pop up if a certain condition is met.
The condition is if the day in a particular cell is Saturday. The particular cell contains the formula =today().

thank you.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I have a similar query and this solution has helped but how do I get the message box to only pop up once? As it is it pops up everytime there is a key entry anywhere else on the sheet.

Then how do I get it to move two cells to the right so the cell selector is in the right place for the next key entry?

Hope you can help!
 
Upvote 0
Hi

The code would normally go in the Workbook_Open Procedure of the Workbook module. Sounds like you have it the:

Worksheet_Calculate
 
Upvote 0
Hi

While in Excel right click on the Excel icon top left next to "File" then select "View Code" This will take you to the Private Module of the Workbook. in here place:

Private Sub Workbook_Open()
If Weekday(Sheet1.Range("A2")) = 7 Then
MsgBox "Hello, today is Saturday", vbInformation
End If

End Sub

But of course this depends on when you want the code to run.
 
Upvote 0

Forum statistics

Threads
1,214,406
Messages
6,119,330
Members
448,888
Latest member
Arle8907

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