Hi,
I am trying to run the following code below which loops through all worksheets in the workbook apart from 2; which then looks in the range ("I4:I34") in each sheet, deleting the entire row if any of these values is 0.
The code seems to only delete a few of the rows containing 0 and am unsure as to what this could be if anyone could offer any expertise?
Sub DelRows
Dim ws as worksheet
Dim Check_Range as range
Dim num as variant
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Run" And ws.Name <> "Template" Then
Set Check_Range = Range("I4:I34")
For Each num In Check_Range
If num.Value <> 0 Then
num.EntireRow.Delete
End If
Next num
End If
Next ws
End Sub
I am trying to run the following code below which loops through all worksheets in the workbook apart from 2; which then looks in the range ("I4:I34") in each sheet, deleting the entire row if any of these values is 0.
The code seems to only delete a few of the rows containing 0 and am unsure as to what this could be if anyone could offer any expertise?
Sub DelRows
Dim ws as worksheet
Dim Check_Range as range
Dim num as variant
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Run" And ws.Name <> "Template" Then
Set Check_Range = Range("I4:I34")
For Each num In Check_Range
If num.Value <> 0 Then
num.EntireRow.Delete
End If
Next num
End If
Next ws
End Sub