What I'm not sure about is the for loop. Is there an easier way to get the do loop to run on each of the seven worksheets? I've never had to run the same code on multiple sheets before so I'm not really sure how it should look.
Private Sub CommandButton2_Click()
Dim i, j As Integer
Dim bob2 As String
Dim bob As Variant
Sheets(Array("Report", "Report (2)", "Report (3)")).Select
For Each sheet In Selection
With ActiveSheet
i = 1
j = 1
.Cells(j, 10).Select
Do
bob = ActiveCell.Value
bob2 = Left(bob, 3)
If bob2 = "SST" Or bob2 = "LC " Or bob2 = "Pac" Or bob2 = "Ind" Or bob2 = "HOL" Or bob2 = " " Or bob = Empty Then
j = j + 1
.Cells(j, 10).Select
Else
ActiveCell.EntireRow.Delete
End If
i = i + 1
Loop Until i = 6000
End With
Next sheet
End Sub
I have assumed that you want the macro to run on all the worksheets :-
Private Sub CommandButton2_Click()
Dim Sh As Worksheet, rng As Range, cell As Range, toDelete As Range
Dim x As Integer, bob As String
Application.ScreenUpdating = False
For Each Sh In Worksheets
Sh.Activate
x = 0
Set rng = Range([I1], [I65536].End(xlUp))
For Each cell In rng
bob = Left(cell.Value, 3)
If bob = "SST" Or bob = "LC " Or bob = "Pac" Or bob = "Ind" Or bob = "HOL" Or bob = " " Or bob = Empty Then
GoTo e
Else
If x <> 0 Then
Set toDelete = Union(toDelete, cell)
Else
x = 1
Set toDelete = cell
End If
End If
e:
Next cell
If x <> 0 Then toDelete.EntireRow.Delete
Next Sh
End Sub