VBA loop? to copy/stack 5-25 columns from 1 tab to another

dsheridan

New Member
Joined
Apr 28, 2015
Messages
1
I'm tryin to copy data from Spreadsheet 1 to Spreadsheet 2.
All of my data that I'm copying starts at row 7 except for the GL account value.


Col A (cost center), Col F (Project) Col's G to ? are dollar amounts. Some sites may only have 2-5 columns, others up to 30 columns starting at G. G6 to ?6 has the account #. G4 to ?4 will either say "proj" or "inf" so I'd only want to do copy/paste for the data under the "proj" columns.


I want to copy the following info to Spreadsheet 2 starting at row 3.
Col A to Col A,

Col F to Col H

G6- autofill to Col K

Col G7-G(end) to Col I

Columns A and F should be constant, so after column G, I'd want it to look at Col H (or the next "proj" column) on spreadsheet 1.

The pasting on spreadsheet 2 should be at the bottom of the first pasted section. So if I copied 20 rows to Sheet 2 above, then when going to the data in Column H:

Col A to Col A
Col F to Col H
H6- autofill to Col K
Col H7-H(end) to Col I.

would be pasted underneath the pasted data (i.e. starting at row 23). and so on- Col A to A, Col F to H, I6 autofill to K and I7:I(end) to col I, etc

Any help would be greatly appreciated!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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