VBA Create new workbook and copy paste data

jayt91

New Member
Joined
Sep 4, 2014
Messages
2
I'm new to the forums and just started learning VBA. I was wondering if anyone could provide some assistance in creating a VBA macro to do the following:

I have a set of data in one workbook which I'll call Workbook1 for instance.

For example, if there is information on a PivotTable like this:
Province
Region
Office
2011
2012
2013
Total
Ontario
A
AA
5
8
5
18
AB
3
6
2
11
AC
3
3
7
13
Total
11
17
14
42
B
BA
1
7
2
10
BC
6
2
2
10
BD
6
8
4
18
Total
13
17
8
38

<TBODY>
</TBODY>


I would like to create a macro (an inputbox maybe) to search for a region (A for example) and create a new workbook & save with the region's name (A.xls for example). The more complicated part (which I failed miserably at trying) would be to then copy the information to the new workbook from columns "office - total" and all the rows from office AA to total. I tried to figure this out searching through the forums but couldn't quite put everything together. Any help would be much appreciated!

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

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