macro to check cell a, if =0 go to cell e, then run macro

Liberteric

New Member
Joined
Sep 29, 2014
Messages
28
If cell A in row 1 equals 0 I need to run a macro from column E "AddLine" (which shifts cells from e thru end-right, down)
If its not equal to 0 I need to continue to run it.

This is what I have but it only inserts a whole row in row a1 then stops

Sub MyInsertMacro()

Dim myLastRow As Long
Dim myRow As Long

Application.ScreenUpdating = False

' Find last row with data in column A
myLastRow = Cells(Rows.Count, "A").End(xlUp).Row

' Loop through all rows in column A, starting at row 1
For myRow = 1 To myLastRow
' Check to see if value in column A is 0
If Cells(myRow, "A") = 0 Then
' call Addline

End If
Next myRow
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,215,781
Messages
6,126,868
Members
449,345
Latest member
CharlieDP

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