NavyPlayboy
New Member
- Joined
- Sep 26, 2011
- Messages
- 2
Hello,
I am just getting back into using excel macros. This is the very basic macro I am using right now:
Sub AddColumn()
'
' AddColumn Macro
' Macro recorded 9/13/2011 by
'
'
Range("A1").Select
Selection.End(xlToRight).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("A1").Select
Selection.End(xlToRight).Offset(0, 1).Select
ActiveSheet.Paste
ActiveCell.EntireColumn.AutoFit
Range("A1").Select
End Sub
This copies the last column of data in my spreadsheet and pastes that data in the following column. It only does it once but I am trying to get it to repeat x number of times without having to re-run the macro. I eventually want to get to the point where a prompt will ask how many columns you would like to add and then have to macro loop that many times. But for now I would settle for just finding out how to get the dang thing to loop. Any help would be appreciated, and I'm a beginner, please be gentle
I am just getting back into using excel macros. This is the very basic macro I am using right now:
Sub AddColumn()
'
' AddColumn Macro
' Macro recorded 9/13/2011 by
'
'
Range("A1").Select
Selection.End(xlToRight).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("A1").Select
Selection.End(xlToRight).Offset(0, 1).Select
ActiveSheet.Paste
ActiveCell.EntireColumn.AutoFit
Range("A1").Select
End Sub
This copies the last column of data in my spreadsheet and pastes that data in the following column. It only does it once but I am trying to get it to repeat x number of times without having to re-run the macro. I eventually want to get to the point where a prompt will ask how many columns you would like to add and then have to macro loop that many times. But for now I would settle for just finding out how to get the dang thing to loop. Any help would be appreciated, and I'm a beginner, please be gentle