Hi,
I'm trying to teach myself macros.
One of the first steps I want to record is to delete rows based on Column C containing text starting with a '1'.
I found the code below from the interwebs.
I have no idea what Columns i and j have to do with the goal.
Could someone suggest something else or explain why the below fails?
Thanks very much as always!!!!!
Sub Delete_Rows_Starting_with_1()
For i = 1 To Selection.Rows.Count
For j = 1 To Selection.Rows.Count
If Left(Selection.Cells(j, 1), 1) = "1" Then
Rows(j + 3).EntireRow.Delete
End If
Next j
Next i
End Sub
I'm trying to teach myself macros.
One of the first steps I want to record is to delete rows based on Column C containing text starting with a '1'.
I found the code below from the interwebs.
I have no idea what Columns i and j have to do with the goal.
Could someone suggest something else or explain why the below fails?
Thanks very much as always!!!!!
VBA Code:
For i = 1 To Selection.Rows.Count
For j = 1 To Selection.Rows.Count
If Left(Selection.Cells(j, 1), 1) = "1" Then
Rows(j + 3).EntireRow.Delete
End If
Next j
Next i
End Sub