Hi All,
I have a problem trying to delete multiple rows with the value 0.
I have encode specific rows with either a 0 or 1 whereby the rows with 1's are needed though the ones in between that may have a 0 need deleting (entire row). The the entire data range does not exceed 360 as it's always a full year of data.
This is what I have
Public Sub Delete1()
Dim cell As Range
Range("ad2:ad360").Select
For Each cell In Selection
If cell.Value = "0" Then
cell.EntireRow.Delete
End If
Next cell
Range("ad2").Select
End Sub
the problem is that it is not deleting rows and getting stuck.
Would anyone have a solution to my problem? I would really appreciate any input here.
thanks in advance
I have a problem trying to delete multiple rows with the value 0.
I have encode specific rows with either a 0 or 1 whereby the rows with 1's are needed though the ones in between that may have a 0 need deleting (entire row). The the entire data range does not exceed 360 as it's always a full year of data.
This is what I have
Public Sub Delete1()
Dim cell As Range
Range("ad2:ad360").Select
For Each cell In Selection
If cell.Value = "0" Then
cell.EntireRow.Delete
End If
Next cell
Range("ad2").Select
End Sub
the problem is that it is not deleting rows and getting stuck.
Would anyone have a solution to my problem? I would really appreciate any input here.
thanks in advance