R
ryguy7272
I got this macro (below) on this DG a while back and used it several times.
I just tried to modify it to insert variable rows in column B and it doesn’t
work. I get an error at:
For I = 1 To Cells(myRow, 1)
I have not idea why this causes an error. Does anyone have a clue? Thanks
in advance!!
Sub InsertVarRows()
Dim myRow As Long
lastcell = Cells(Rows.Count, "B").End(xlUp).Row
myRow = 1
Do Until myRow = lastcell
For I = 1 To Cells(myRow, 1)
If Cells(myRow, 1) <> "" Then
Cells(myRow + 1, 1).Select
Selection.Insert shift:=xlDown
End If
Next
lastcell = Cells(Rows.Count, "B").End(xlUp).Row
myRow = myRow + 1
Loop
End Sub
I just tried to modify it to insert variable rows in column B and it doesn’t
work. I get an error at:
For I = 1 To Cells(myRow, 1)
I have not idea why this causes an error. Does anyone have a clue? Thanks
in advance!!
Sub InsertVarRows()
Dim myRow As Long
lastcell = Cells(Rows.Count, "B").End(xlUp).Row
myRow = 1
Do Until myRow = lastcell
For I = 1 To Cells(myRow, 1)
If Cells(myRow, 1) <> "" Then
Cells(myRow + 1, 1).Select
Selection.Insert shift:=xlDown
End If
Next
lastcell = Cells(Rows.Count, "B").End(xlUp).Row
myRow = myRow + 1
Loop
End Sub