Hello all,
I have about 51 worksheets in a workbook. I need to delete a couple of rows in column B. I try the following code and it's not working how i want it to. Can someone take a look and guide me in the right direction? I want to loop through all the worksheets and delete the rows.
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
Dim sh As Worksheet
Dim Last As Integer
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count 'Count of all Workheet tabs'
Sheets("A1 Replace Citichecking").Activate
' Begin the loop.
For Each sh In ActiveWorkbook.Worksheets
Sheets("A1 Replace Citichecking").Select
Last = Cells(Rows.Count, "B").End(xlUp).Row
For I = 1 To Last
If (Cells(I, "B").Value) = "19. B Missed Deliveries - Reported Month" Then
Cells(I, "B").EntireRow.ClearContents ' USE THIS TO CLEAR CONTENTS BUT NOT DELETE ROW
Cells(I, "B").EntireRow.Delete
End If
Next I
Next
Bookmarks