I have a workbook which contains 7 worksheets of various row length. I have a macro that already performs various tasks which works fine but now I would like to add to it by searching every worksheet and deleting any row that contains a 0 or the text NULL in column A.
After a search, I found the following but it only works on the active worksheet.
After a search, I found the following but it only works on the active worksheet.
VBA Code:
Sub test()
Dim i As Long
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Sheets
For i = sht.UsedRange.Rows.Count To 2 Step -1
If Cells(i, 1).Value = "NULL" OR Cells(i, 1).Value = 0 Then Cells(i, 1).EntireRow.Delete
Next i
Next sht
End Sub