Hi guys, I have an Excel file with defined macros that are opening specific PPT files. I'm looking for a VBA code that will run a specific macro base

avi2go

New Member
Joined
Jun 11, 2017
Messages
6
Hi guys,


I have an Excel file with defined macros that are opening specific PPT files.
I'm looking for a VBA code that will run a specific macro based on if certain cells are empty and other are not.


For example:
If cells B1 and B2 are empty but cell B3 isn't --> then run Macro1
If cells B1, B2 & B3 are empty but cell B4 isn't --> then run Macro2


Is it possible?
Many thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Actualy it's the other way around:

If cells B1 and B2 are NOT empty but cell B3 is empty --> then run Macro1
If cells B1, B2 & B3 are NOT empty but cell B4 is empty --> then run Macro2
 
Upvote 0
Code:
  If VarType(Range("B1").Value) <> vbEmpty And _
     VarType(Range("B2").Value) <> vbEmpty Then
    If VarType(Range("B3").Value) = vbEmpty Then
      Call Macro1
    ElseIf VarType(Range("B4").Value) = vbEmpty Then
      Call Macro2
    End If
  End If
 
Upvote 0

Forum statistics

Threads
1,215,546
Messages
6,125,459
Members
449,228
Latest member
moaz_cma

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