Copy

balaji3081

New Member
Joined
May 10, 2013
Messages
17
Hi All.

I am looking for a macro to find the text in Col A, and copy multiple cells based on a column heading for eg as in the below table

Look for text -
"Total Sales X country"
"Total Sales Y country"

and from the same rows copy from cells with column heading as Quater 1 and Quater 2 and paste into a new file ( All data.xlsx)
NOTE
- All data file has the heading Quarter 1 and Quater 2 already mentioned.
- the heading change month over month so wanted it to mentioned outside the macro.

Any help appreciated here , Thanks

JanFebMarQuarter1AprMayJuneQuarter 2
text13451279521
text2256131113
text3333924511
text34631341510
Total sales X country1118174614151645
text4
text5
text6
Total sales Y country444123339
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Where exactly in the All data.xlsx file do you want it copied to (to what sheet name, to which cell(s))?
Also, I don't understand what "the heading change month over month so wanted it to mentioned outside the macro" means?
 
Upvote 0
Thanks Kevin for replying.

For this question purpose the table starts in Cell B2, so you can take it as B3 is where start pasting the data

In All data file I should be able to change the heading from Quarter 1 to Full year or to any month and still get the corresponding data
 
Upvote 0
Thanks Kevin for replying.

For this question purpose the table starts in Cell B2, so you can take it as B3 is where start pasting the data

In All data file I should be able to change the heading from Quarter 1 to Full year or to any month and still get the corresponding data
You've answered the second part of my first question (which cells to copy to) but you still haven't said to which sheet.

Where you say "In All data file I should be able to change the heading from Quarter 1 to Full year or to any month and still get the corresponding data", does that mean that you want to be able to change the headings in the All data file and return all columns that match whatever your headings in the All data file are?

Also, will you be running the code from the file that contains the table in post #1? If so, what is the sheet name of the sheet where the table is located?
 
Upvote 0
All data tab has only one sheet = "Summary"

Where you say "In All data file I should be able to change the heading from Quarter 1 to Full year or to any month and still get the corresponding data", does that mean that you want to be able to change the headings in the All data file and return all columns that match whatever your headings in the All data file are? - "YES"

The table in post one is from All data tab and the tab name is - "Summary"

The data from multiple files which needs to be copied are in tab name - "Data" - for coding purpose itr can be names as Product 1, Product2, product3, Product4.....

Hope this helps
 
Upvote 0
I'm sorry but your explanation has only served to confuse me further. I'm afraid I'm going to have to leave this to others who may have a clearer understanding of your requirements. Thank you and good luck.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

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