John Davis
Well-known Member
- Joined
- Sep 11, 2007
- Messages
- 3,457
Hello All:
I have the following:
Can someone tell me why it does not work??
I have the following:
Code:
Sub Test()
Dim x As Variant
Dim i As Long
Dim lr As Long
lr = Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row
lr2 = Sheets("Sheet4").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets("Sheet3")
x = Array("WORD1", "WORD2", "WORD3", "WORD4")
For i = LBound(x) To UBound(x)
.Range("A2:AA" & lr).AutoFilter Field:=6, Criteria1:=x
.Range("A2:AA" & lr).EntireRow.SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet4").Range("A" & lr2)
.Range("A2:AA" & lr).AutoFilter
Next i
End With
End Sub
Can someone tell me why it does not work??