View Single Post
 
Old 02-03-2017, 02:28 PM
ThisGuyJohn ThisGuyJohn is offline Windows 7 64bit Office 2016
Novice
 
Join Date: Jan 2017
Posts: 6
ThisGuyJohn is on a distinguished road
Default

On the top of the code where it says With ActiveSheet

Code:
Sub Filter()
    Dim b As Long
    With ActiveSheet
        For b = .Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1
            With .Rows(b)
just add With "what ever the worksheet is called" - without the quotes
for example

With sheet2
With sheet3

then you need to add "end with" for each "with" you add I put in on the bottom

for Ex:

Code:
Sub Filter()
    Dim b As Long
    With ActiveSheet
With sheet2
With sheet3
With sheet4
With sheet5
        For b = .Cells(Rows.Count, "b").End(xlUp).Row To 1 Step -1
            With .Rows(b)
                
                    If Not .Range("b1").Value = "Country" Then
                    If Not .Range("b1").Value = "Spain" Then
                    If Not .Range("b1").Value = vbNullString Then
                        .Delete
                    End If
                    End If
                    End If
                
            End With
        Next b
    End With
End With
End With
End With
End With
    
End Sub
Reply With Quote