VBA: If Auto filter has no data then it has to move to next filter

Meenatshi

New Member
Joined
Dec 13, 2017
Messages
3
Hello Experts,

Requesting you to review my macro. i have tried little bit and i am new to this so please help me out. I want to save the file into two different format based on criteria that i have done. but while filtering if no data for that respective criteria then it has to move to next filter option. kindly help.

below are the codes.

ThisWorkbook.Sheets("Upload Template").Activate
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Range("B1").Select
ActiveSheet.Range("$A$1:$M$334").AutoFilter Field:=2, Criteria1:= _
"Lockbox-PNC-677971B"
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ChDir _
"\\Itinblr05sfps01\ifsc - ar\Operations Team\Susikaran-DBS\Macro File location"
ActiveWorkbook.SaveAs Filename:= _
"\\Itinblr05sfps01\ifsc - ar\Operations Team\Susikaran-DBS\Macro File location\Lockboxpnc677971.csv" _
, FileFormat:=xlCSVUTF8, CreateBackup:=False
Range("I8").Select
ActiveWorkbook.SaveAs Filename:= _
"\\Itinblr05sfps01\ifsc - ar\Operations Team\Susikaran-DBS\Macro File location\Lockboxpnc677971.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Range("B39").Select
Selection.End(xlUp).Select
ActiveSheet.Range("$A$1:$M$334").AutoFilter Field:=2, Criteria1:= _
"Lockbox-PNC-772863"
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
"\\Itinblr05sfps01\ifsc - ar\Operations Team\Susikaran-DBS\Macro File location\Lockboxpnc772863.csv" _
, FileFormat:=xlCSVUTF8, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:= _
"\\Itinblr05sfps01\ifsc - ar\Operations Team\Susikaran-DBS\Macro File location\Lockboxpnc772863.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
ActiveSheet.Range("$A$1:$M$334").AutoFilter Field:=2, Criteria1:= _
"Lockbox-PNC-775139"
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top