Need to add Message Box in VBA to force two Macros to be Run in Order

Flapjack

Board Regular
Joined
Aug 24, 2005
Messages
59
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that has two macros in it. It is important that macro #1 is run before macro #2. People may not follow instructions, so I want a message box to pop up if they first try to run macro #2, and tell them to run macro #1 first and then exit out of that macro. When someone does run macro #1, it populates cell A4 with a letter, so I'm thinking that at the start of macro #2 it checks for a value in A4. If there is a value, then continue running macro #2. If no value, then the message box pops up with the warning and an OK button to exit back to the spreadsheet.

My VBA skills are badly rusty and I'm doing this as a favor to someone and it has some time constraints getting this project done. I appreciate any help!
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,463
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It would be something like:

Code:
If Len(Sheets("sheet name").Range("A4").Value) = 0 then
    msgbox "You must run macro 1 first!
   Exit Sub
End If
 
Solution

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,463
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Glad to help. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,590
Messages
5,625,674
Members
416,125
Latest member
NeedExcelHelp2021

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
Top