storemannequin
Board Regular
- Joined
- May 29, 2010
- Messages
- 108
I'm trying to set up a code to filter the data in my activesheet and then copy the visible cells to a new workbook but keep getting debug areas in just this first portion of the code. Can anyone tell me how to adjust? thanks
Code:
Sub filter()
FR = Cells(Rows.Count, 1).End(xlUp).Row
Set WBA = ActiveSheet
Set WBD = Workbooks.Add(template:=xlWBATWorksheet)
Set rng = WBA.Cells(2, 1).Resize(FR - 1, 1)
Cells(1, 1).autofilter
ActiveSheet.Range("$A$1:A" & FR).autofilter Field:=2, Criteria1:=Array( _
"DEXIS", "GENDEX", "IMGSCI", "KAVO", "P&C"), Operator:=xlFilterValues
rng.SpecialCells(xlCellTypeVisible).EntireRow.Copy Destination:=WBD.Sheets(1).Cells(2, 1)
End Sub