![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Try
If Weekday(Range("A2")) = 7 Then MsgBox "Hello, today is Saturday", vbInformation End If |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
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! |
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi
The code would normally go in the Workbook_Open Procedure of the Workbook module. Sounds like you have it the: Worksheet_Calculate |
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
It says Worksheet_SelectionChange
What should it be on? |
|
|
|
#6 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|