Liberteric
New Member
- Joined
- Sep 29, 2014
- Messages
- 28
I have a macro named AddLine that inserts a row. The macro below is supposed to check each row in column A, if A=0, it should run AddLine, if not, it should go down a row then test it again. This is my macro. It treats all values in column A as 0.
Column A has and If to determine whether to put a 0 or 1 in the cell. Could it be a data issue?
Sub MyInsertMacro()
Dim myLastRow As Long
' 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
' Check to see if value in column A = 0, If true, run macro AddLine
If Cells(myRow, "A") = 0 Then
AddLine
End If
On Error GoTo 0
Next myRow
End Sub
Column A has and If to determine whether to put a 0 or 1 in the cell. Could it be a data issue?
Sub MyInsertMacro()
Dim myLastRow As Long
' 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
' Check to see if value in column A = 0, If true, run macro AddLine
If Cells(myRow, "A") = 0 Then
AddLine
End If
On Error GoTo 0
Next myRow
End Sub