I have data on Sheet "Imported Data in Cols A:V
I have branch code codes in Col V and have tried to write code to extract the data to sheets "BR 98150" ,"BR98151" "BR 98154" The criteria is in Z1:Z2 on these sheets
The 3 sheets are next to each other ("BR 98150" ,"BR98151" "BR 98154"
However when running the macro, I get a type Mismatch and the code below is highlighted
See full code below
I have branch code codes in Col V and have tried to write code to extract the data to sheets "BR 98150" ,"BR98151" "BR 98154" The criteria is in Z1:Z2 on these sheets
The 3 sheets are next to each other ("BR 98150" ,"BR98151" "BR 98154"
However when running the macro, I get a type Mismatch and the code below is highlighted
Code:
Sheets("Imported Data").Range("A1:V1000").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets(ws).Range("Z1:Z2"), CopyToRange:=Sheets(ws).Range("A1"), Unique:=False
See full code below
Code:
Sub DataExtraction()
For Each ws In Sheets(Array("BR 98150", "BR 98151", "BR 98154"))
With ws
Sheets("Imported Data").Range("A1:V1000").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets(ws).Range("Z1:Z2"), CopyToRange:=Sheets(ws).Range("A1"), Unique:=False
End With
Next ws
Application.ScreenUpdating = True
End Sub