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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,778
Messages
6,174,482
Members
452,566
Latest member
Bonnie_bb

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