move cell to next column

ADZEAN83

New Member
Joined
Nov 5, 2011
Messages
2
Hi,

I'm new to using macros and VBA in excel. I am trying to store data in another worksheet but it does not automatically move to the next column. I want to store incrementally to the right of the last column with data on the second sheet.

my macro code below as follows:
===

Sub Macro6()
'
' Macro6 Macro

Columns("A:E").Select ' select columns a to e in sheet1
Selection.Copy ' copy data in the columns
Sheets("Sheet2").Select ' SELECT SHEET 2
Range("A1").Select ' SELECT CELL A1 IN SHEEET 2
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False 'paste special
Sheets("Sheet1").Select 'go back to a1 sheet 1

' at this portion i am lost as to what should happen next.

End Sub
===
what i wanna happen is have a store button with this macro which will store incrementally in sheet2 moving to the right. when i click the button, macro should not overlap but should store to the right column after the last data stored.

thanks!

I am using window xp with office 2007.
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this

Code:
Sub test()
Sheets("Sheet1").Columns("A:E").Copy
Sheets("Sheet2").Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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