Liberteric
New Member
- Joined
- Sep 29, 2014
- Messages
- 28
I have a macro button named "AddLine" that shifts cells down from E thru (End Right) as long as I start in column E.
I want to test each line and if A = 0, run the macro "AddLine", if not then move down a line and repeat. I tried the following but it only inserts from the first row (which doesn't equal zero).
Row A is a formula. If(Br=Er,1,0). Is my test to see if a=0 returning a fal se because it's an if rather than the actual number 0? Below is my macro.
Sub MyInsertMacro()
' Starts in E1
Range("E1").Select
Application.ScreenUpdating = False
' Find last row with data in column B
myLastRow = Cells(Rows.Count, "B").End(xlUp).Row
' Loop through all rows in column A, starting at row 1
For myRow = 1 To myLastRow Step 1
' Check to see if value in column A = 0, If true, run macro AddLine
If Cells(myRow, "A") = 0 Then
Call AddLine
End If
Next myRow
Application.ScreenUpdating = True
I want to test each line and if A = 0, run the macro "AddLine", if not then move down a line and repeat. I tried the following but it only inserts from the first row (which doesn't equal zero).
Row A is a formula. If(Br=Er,1,0). Is my test to see if a=0 returning a fal se because it's an if rather than the actual number 0? Below is my macro.
Sub MyInsertMacro()
' Starts in E1
Range("E1").Select
Application.ScreenUpdating = False
' Find last row with data in column B
myLastRow = Cells(Rows.Count, "B").End(xlUp).Row
' Loop through all rows in column A, starting at row 1
For myRow = 1 To myLastRow Step 1
' Check to see if value in column A = 0, If true, run macro AddLine
If Cells(myRow, "A") = 0 Then
Call AddLine
End If
Next myRow
Application.ScreenUpdating = True