Copy Colum and Paste Special to Colum to Right - Incrementally

robbydogg

New Member
Joined
Feb 23, 2009
Messages
33
Hello,

Could anyone help me with this one?
I wans to copy all data from column H, then Past it as values to Column I, then next time i press the button for column H data to paste specail to Column J and so on - so it keeps adding the data to the next column automatically.
Can anyone help me with the macro code for this?

Thanks
Rob
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this macro:
Code:
Sub CopyRowH()
Dim lastrow As Long
Dim nextcol As Long

lastrow = Range("H65000").End(xlUp).Row
nextcol = Range("H1").End(xlToRight).Offset(0, 1).Column

Application.ScreenUpdating = False
Application.EnableEvents = False
    
    Range("H1:H" & lastrow).Copy
    Cells(1, nextcol).PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    Range("H1").Select

Application.ScreenUpdating = True
Application.EnableEvents = Trur

End Sub
 
Upvote 0
Sorry, try this instead. My bad.
Code:
Sub CopyRowH()
Dim lastrow As Long
Dim nextcol As Long

lastrow = Range("H65000").End(xlUp).Row
nextcol = Range("IQ1").End(xlToLeft).Offset(0, 1).Column

Application.ScreenUpdating = False
Application.EnableEvents = False
    
    Range("H1:H" & lastrow).Copy
    Cells(1, nextcol).PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    Range("H1").Select

Application.ScreenUpdating = True
Application.EnableEvents = Trur

End Sub
 
Upvote 0
hi, thanks again for that. works a treat!!!
(now watch someone delete the button i assigned it to :) )
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,183
Members
449,071
Latest member
cdnMech

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