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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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