Macro question

  • Thread starter Thread starter Keith Kaminetzky
  • Start date Start date
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top