Paste Special values from individual columns - vba

pandora1234

New Member
Joined
Aug 10, 2014
Messages
1
Hi I have to copy values from columns A, D and E from one worksheet to the same columns in another worksheet. I want to use vba as its a fiddly process otherwise. It would be easier to copy the whole range of data initially from A to F, but then click a button on the second worksheet to paste special the selected column values into the second worksheet. Any ideas how I could do this? I'm using excel 2007, and would assign the macro to the quick toolbar at the top. Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
data in sheet1 like this

Sheet1

*ABCDEF
1141590884861
222578471681
3983222656816
4943441456597
544440681337
6131876285481
7854198964635
865525213665
935989222030

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4




try this macro and SEE SHEET2


Code:
Sub test()
Dim col(1 To 3), j As Long
Worksheets("sheet2").Cells.Clear
col(1) = "A"
col(2) = "D"
col(3) = "E"




With Worksheets("sheet1")
For j = 1 To 3
Range(.Cells(1, col(j)), .Cells(1, col(j)).End(xlDown)).Copy
With Worksheets("sheet2")
.Cells(1, j).PasteSpecial
End With
Next j
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,389
Messages
6,124,665
Members
449,178
Latest member
Emilou

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