Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to run a macro many times simpler?

Hi,

I have written a macro in Excel to run a series of key strokes with a
fast key, say Alt-a, to initiate the execution. But I need to run
that macro many times. One way to do that is pressing Alt-a the
needed number of times. May I ask if there is another way that does
it simpler? Thanks in advance.

Mic
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to run a macro many times simpler?

Sub currentMacroName()
for i = 1 to 10
' current code
Next
End Sub

--
Regards,
Tom Ogilvy

"cyberdude" wrote in message
om...
Hi,

I have written a macro in Excel to run a series of key strokes with a
fast key, say Alt-a, to initiate the execution. But I need to run
that macro many times. One way to do that is pressing Alt-a the
needed number of times. May I ask if there is another way that does
it simpler? Thanks in advance.

Mic



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to run a macro many times simpler?

Mic

or you can CALL that procedure from another procedure using a loop.


Code
-------------------

Sub RunMacroManyTines()
Dim i As Long
For i = 1 To 100
Call YourMacro 'plece here the name of your procedure
Next
End Sub

Sub YourMacro()
Debug.Print "hey"
End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default How to run a macro many times simpler?

following on from Tom's suggestion you can make the number of times
interactive e.g.

Sub currentMacroName()
for i = 1 to inputbox("How many times would you like to run the code?","Run
Code",10)
' current code
Next
End Sub

"cyberdude" wrote in message
om...
Hi,

I have written a macro in Excel to run a series of key strokes with a
fast key, say Alt-a, to initiate the execution. But I need to run
that macro many times. One way to do that is pressing Alt-a the
needed number of times. May I ask if there is another way that does
it simpler? Thanks in advance.

Mic



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
is there a simpler way to do this formula? Jenna Excel Worksheet Functions 5 March 1st 10 10:57 PM
VBA code simpler? mohavv Excel Discussion (Misc queries) 4 December 2nd 07 06:39 AM
Complex formula vs. simpler GerryK Excel Worksheet Functions 3 December 6th 05 03:33 PM
Another (simpler?) printing problem Abi Excel Discussion (Misc queries) 9 January 13th 05 03:50 AM
Lil Simpler ksnapp[_16_] Excel Programming 3 March 4th 04 12:32 AM


All times are GMT +1. The time now is 05:22 AM.

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

About Us

"It's about Microsoft Excel"