Skip Macro with IF Condition

earthworm

Well-known Member
Joined
May 19, 2009
Messages
773
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
If i want to skip one macro if the value in cell for example A1 is 0 then move to next macro .

How can i do this. I am not sharing any example because i only want to understand the formula construction
 

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
Something like
Code:
If Range("A1").Value = 0 Then
    Call Macro2
Else
    Call Macro1
End If
Should do it. For more than 2 options, take a look at Select Case as an alternative method.
 
Upvote 0
If the value in cell B3 is 0 then i want macro to write value in cell E3 as B and if value in cell B3 is >0 then i want macro to write value in cell E3 as A

Code:
Sub Macro3()'
' Macro3 Macro
'


'
    ActiveCell.FormulaR1C1 = "A"
    Range("E3").Select
    ActiveWindow.SmallScroll Down:=-6
    ActiveCell.FormulaR1C1 = "b"
    Range("E3").Select
End Sub

I am writing a simple macro to clear my understanding . please help
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,083
Members
453,021
Latest member
Justyna P

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