califorlina
New Member
- Joined
- Mar 3, 2015
- Messages
- 16
Hi, Completely stuck on this - I would like this macro to search all worksheets in the workbook and delete any row that contains 920 in column B. The code below only deletes on the active sheet:
Sub DeleteRowsTest()
Dim i As Integer
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For i = 1 To Range("B" & "65536").End(xlUp).Row Step 1
If Application.WorksheetFunction.CountIf(Range("A" & i & ":AZ" & i), "920") > 0 Then
ws.Range("B" & i).EntireRow.Delete
End If
Next i
Next ws
End Sub
Any assistance would be greatly appreciated!
Sub DeleteRowsTest()
Dim i As Integer
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For i = 1 To Range("B" & "65536").End(xlUp).Row Step 1
If Application.WorksheetFunction.CountIf(Range("A" & i & ":AZ" & i), "920") > 0 Then
ws.Range("B" & i).EntireRow.Delete
End If
Next i
Next ws
End Sub
Any assistance would be greatly appreciated!