#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Looping a macro

I want my macro to call on itself at the end and keep performing the loop 20
times. How can I do that? Any help will be much appreciated.

TIA
Sony


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 390
Default Looping a macro

In , Sony
spake thusly:

I want my macro to call on itself at the end and keep performing
the loop 20 times. How can I do that? Any help will be much
appreciated.


You could, instead of calling the macro over and over,
loop through the actions 20 time:

Option Explicit
Sub total_recall()

For N = 1 To 20

'do something

Next 'N
End Sub


Or if you wanted, you could have "do something" turn out
to be to call a different macro.


Option Explicit
Sub total_recall()

For N = 1 To 20

Application.Run "macro_name"

Next 'N
End Sub

-dman-
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Looping a macro

That was a good alternative idea. Thank you Dallman Ross.

Sony
"Dallman Ross" <dman@localhost. wrote in message
...
In , Sony
spake thusly:

I want my macro to call on itself at the end and keep performing
the loop 20 times. How can I do that? Any help will be much
appreciated.


You could, instead of calling the macro over and over,
loop through the actions 20 time:

Option Explicit
Sub total_recall()

For N = 1 To 20

'do something

Next 'N
End Sub


Or if you wanted, you could have "do something" turn out
to be to call a different macro.


Option Explicit
Sub total_recall()

For N = 1 To 20

Application.Run "macro_name"

Next 'N
End Sub

-dman-



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 390
Default Looping a macro

In , Sony
spake thusly:

That was a good alternative idea. Thank you Dallman Ross.


Good. Glad it helped.

-dman-

==============================
"Dallman Ross" <dman@localhost. wrote in message
...
In , Sony
spake thusly:

I want my macro to call on itself at the end and keep performing
the loop 20 times. How can I do that? Any help will be much
appreciated.


You could, instead of calling the macro over and over,
loop through the actions 20 time:

Option Explicit
Sub total_recall()

For N = 1 To 20

'do something

Next 'N
End Sub


Or if you wanted, you could have "do something" turn out
to be to call a different macro.


Option Explicit
Sub total_recall()

For N = 1 To 20

Application.Run "macro_name"

Next 'N
End Sub

-dman-

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM
Looping Macro That adds a blank row between different part #'s fiero84 Excel Discussion (Misc queries) 5 March 25th 05 06:59 AM
macro to browse for workbook, pick up data and looping uriel78 Excel Worksheet Functions 1 March 10th 05 12:37 PM


All times are GMT +1. The time now is 04:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"