Macro to auto filter, copy, paste it into a new workbook and save it.

Akshay_divecha

Board Regular
Joined
Mar 11, 2014
Messages
70
Hi Experts,

I'm basically a noob when it comes to creating macros in excel.

I find the below issue seems to be more of a loop point. Kindly assist. Thanks in advance.


Workbook 1
I have 25 columns with variable rows.
Here the 14 Column needs to be filtered. 14 Column name is "Type of Vehicle"
Say for example Status column usually contains values of (for example) "Auto" , "Bus" ,"Train etc."

So what I would like to achieve is
1.Apply autofilter first -> Range("A1:Y1").autofilter
2.Filter "Type of Vehicle" column for each value in that column like the above three example criteria stated above
3.Open a new workbook 2 (this already has a predetermined format & details in it already)
4.Copy Data from Workbook 1 cell U2 and Paste it to new workbook 2 G3
5.Copy Data from Workbook 1 cell V2 and Paste it to new workbook 2 I3
6.Copy Data from Workbook 1 cell N2 and Paste it to new workbook 2 D9
7.Copy Data from Workbook 1 cell 02 and Paste it to new workbook 2 F9
8.Copy Data from Workbook 1 cell F:J and Paste it to new workbook 2 A19
9.Save the workbook 2 with the name as D9 & F9
10. Repeat the same for other values in "Type of vehicle"
11. Pop up once all done.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,907
Messages
6,122,183
Members
449,071
Latest member
cdnMech

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