Macro question

K

Keith Kaminetzky

I am trying this for the first time.

I want to copy two sidy by side cells and past into the two rows below.
then move on to the next entry and repeat. I just do not know how to tell
the macro to loop till it gets to the end of the data in the spreadsheet.
Any help is appreciated. TIA KK
Code below


Sub Macro2()
'
' Macro2 Macro
' Macro recorded 11/15/2003 by
'
' Keyboard Shortcut: Ctrl+n
'
ActiveCell.Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1:A2").Select
ActiveSheet.Paste
ActiveCell.Offset(2, 0).Range("A1:B1").Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1:A2").Select
ActiveSheet.Paste


End Sub
 
B

Bob Keating

I usually check for the contents of the next cell to be
affected. If it is empty the macro stops. You can also
determine the range you want to operate on by starting in
the first cell and resizing using xlDown or xlRight, et
cetera. Finally, put a counter in the loop so it is
limited in case something goes wrong.
 
Top