PDA

View Full Version : Conditional Copy Paste Code



Herbiec09
05-11-2013, 08:22 AM
Hi all,

Looking for some help on a quirky copy paste scenario. I would like to set up a consolidation spreadsheet for a number of companies in a group by creating a mini database that i can have formulas looking into.

I have a template that each of our 5 companies uses to submit their information. The info i am copying is in say column B. This information needs to be copied into another excel spreadsheet. Is vba clever enough to paste the data into certain columns depending on the month that the data relates to say. An example would be January data would be copied from column b in the source spreadsheet to column c in the database. The following month when I run the macro, February data (exactly the same template as Jan) wud be copied from column b in the source spreadsheet to column d in the database etc.

Could anyone assist with a code and ways to set this up.

Thanks

Herbez

SamT
05-11-2013, 11:01 AM
Hi all,

Looking for some help on a quirky copy paste scenario. I would like to set up a consolidation spreadsheet for a number of companies in a group by creating a mini database that i can have formulas looking into.

I have a template that each of our 5 companies uses to submit their information. The info i am copying is in say column B. This information needs to be copied into another excel spreadsheet. Is vba clever enough to paste the data into certain columns depending on the month that the data relates to say. An example would be January data would be copied from column b in the source spreadsheet to column c in the database. The following month when I run the macro, February data (exactly the same template as Jan) wud be copied from column b in the source spreadsheet to column d in the database etc.

Could anyone assist with a code and ways to set this up.

Thanks

Herbez
I am having to guess here, because your language is imprecise. A Work book contains Worksheets, sometimes known as Tabs. A Spreadsheet can be one or more Worksheets in a workbook. Excel has no problem working on multi-sheet spreadsheets.

I am assuming that your 5 companies send their Data (information) in a Workbook.

The Consolidation Workbook you should use should contain 6 worksheets: Five database table sheets for recording each company's data, by date, and one Report sheet that contains the formulas that do the work.

It is simple for VBA to extract a company's identifier from their data submission workbook and paste it in the appropriate row of the appropriate database sheet.

If this Data Structure is ok with you, Prepare and upload a sample data consolidation Workbook that also includes a sample Data Submission Sheet to it so we can see your Data Structure. Be sure and let us know the Names of the various Data Submission Workbooks and the Tab name(s) of any data sheet(s) in them.

To keep all persoanl and proprietary information out, use aliases for the companies and any other info you want to keep.

Data Structure just means the Headers and the physical layout and labels of the Database Sheets and the Data Submission sheet.