How to repeat a macro indefinitely?

Jagzed

New Member
Joined
May 6, 2002
Messages
16
Hi, I registered a simple macro to select 5 rows selected in a column, then copy/paste and format on a single line (5 columns)
I created a button and attached the macro.
But I don't want to click 8000 time on my button.
What is the code to repeat the macro?
Something like repeat.macro???
Thanks
Jagzed
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Do you want the macro to repeat 8000 times, or until some condition is satisfied?

If the latter, what is the condition?

Can you post some of your code?
This message was edited by hedrijw on 2002-08-28 11:35
 
Upvote 0
Do and Loop of course!!!
Thanks!!!!!
Here is my code... if it can be useful for someone...
********************
Sub OrderAddress()
Do
Range("A1:A5").Select
Range("A5").Activate
Selection.Copy
Range("D1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("D1:I1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Address").Select
ActiveSheet.Paste
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("A1").Select
Sheets("Temp").Select
Rows("1:6").Select
Selection.Delete Shift:=xlUp
Loop
End Sub
***************
1. In the first worksheet, select the top five rows (column A), copy it, paste and transpose in the same worksheet
2. Select this five new cells, cut and paste in the worsheet "Temp" (A1)
3. Insert a new row in the top of "Temp"
4. Return in the first worksheet and delete the 6 first rows.
 
Upvote 0

Forum statistics

Threads
1,223,579
Messages
6,173,173
Members
452,505
Latest member
Alice34

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