C
Chuck W
Hi, I am trying to learn about using loops to repeat a macro. For
example I have a list of items in Column C, one item on every line. I
want to copy them to say Column E with an empty cell below every item.
I used the "Record Macro to get the code to do it once.
I think the problem is that when it repeats it goes back to C2 rather
than move down the list. When reading about loops I think I understand
it but evidently I don't . I've used Excel but only the basics.
I would like to learn how to do three things.
1. Have the Macro repeat down the column until it comes to an empty
row?
2. And for future use have it do it for a set number of times ex. 20?
3. Where do I put the new code in the nacro I recorded ?
Sub learnloops()
'
' learnloops Macro
' Macro recorded 9/5/2003 by
'
' Keyboard Shortcut: Ctrl+c
Range("C2").Select
Selection.Copy
Range("E2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C3").Select
Selection.Copy
Range("E4").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Thanks,
Chuck
example I have a list of items in Column C, one item on every line. I
want to copy them to say Column E with an empty cell below every item.
I used the "Record Macro to get the code to do it once.
I think the problem is that when it repeats it goes back to C2 rather
than move down the list. When reading about loops I think I understand
it but evidently I don't . I've used Excel but only the basics.
I would like to learn how to do three things.
1. Have the Macro repeat down the column until it comes to an empty
row?
2. And for future use have it do it for a set number of times ex. 20?
3. Where do I put the new code in the nacro I recorded ?
Sub learnloops()
'
' learnloops Macro
' Macro recorded 9/5/2003 by
'
' Keyboard Shortcut: Ctrl+c
Range("C2").Select
Selection.Copy
Range("E2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C3").Select
Selection.Copy
Range("E4").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Thanks,
Chuck