AUTO FILTER WITH VALUE IN CELLS AND COPY FILTERED DATA TO NEW FILE

E

Eddy Stan

HI

CODE IN FOR AUTO FILTER & COPY TO NEW FILE

' FOR FIELD 2 "TPT" IS IN RANGE("B2").VALUE
' FOR FIELD 3 "WEST" IS IN RANGE("C2").VALUE
' FOR FIELD 4 "AURANGABAD BRANCH" IS IN RANGE("D2").VALUE

'Selection.AutoFilter Field:=2, Criteria1:="TPT"
'Selection.AutoFilter Field:=3, Criteria1:="WEST"
'Selection.AutoFilter Field:=4, Criteria1:="AURANGABAD BRANCH"
' WANT TO SAVE OUTFILE XLS AS AURANGABAD.XLS

ANY HELP URGENT. PLEASE
 
P

Per Jessen

HI

CODE IN FOR AUTO FILTER & COPY TO NEW FILE

    ' FOR FIELD 2 "TPT" IS IN RANGE("B2").VALUE
    ' FOR FIELD 3 "WEST" IS IN RANGE("C2").VALUE
    ' FOR FIELD 4 "AURANGABAD BRANCH" IS IN RANGE("D2").VALUE

    'Selection.AutoFilter Field:=2, Criteria1:="TPT"
    'Selection.AutoFilter Field:=3, Criteria1:="WEST"
    'Selection.AutoFilter Field:=4, Criteria1:="AURANGABAD BRANCH"
    ' WANT TO SAVE OUTFILE XLS AS AURANGABAD.XLS

ANY HELP URGENT. PLEASE

Hi

Dim wb As Workbook
Dim wb1 As Workbook

Set wb = ThisWorkbook
Set wb1 = Workbooks.Add
wb.Activate
Range("A1:D10").Copy wb1.Sheets(1).Range("A1") ' Change Range to suit
sPath = "C:\Temp\" ' Change to suit
fName = "AURANGABAD.XLS"
wb1.SaveAs Filename:=sPath & fName

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top