Copy Multiple Columns with VBA

Amruiz4517

New Member
Joined
Jan 22, 2018
Messages
1
I need to write a macro that will copy columns A, G, H, K, Q, and Y rows 2 through 51 in all columns from an active work sheet.

Subsequently, I will then need another one to paste the values of the columns into cells AA51:AF100.
 

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.
Hi & welcome to the board
This will copy the relevant ranges from the active to a sheet called Sheet2 (change to suit)
Code:
Sub CopyData()
Range("A2:A51,G2:H51,K2:K51,Q2:Q51,Y2:Y51").Copy Sheets("[COLOR=#ff0000]Sheet2[/COLOR]").Range("AA51")
End Sub
This copies everything, but the one below copies values only
Code:
Sub CopyValues()
Sheets("Sheet2").Range("AA51:AF100").Value = Range("A2:A51,G2:H51,K2:K51,Q2:Q51,Y2:Y51").Value
End Sub
 
Last edited:
Upvote 0
Try this.
Code:
Intersect(Range("A:A, G:H, K:K, Q:Q, Y:Y"), Rows(2).Resize(50)).Copy Range("AA51")
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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