ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running a Macro a number of times (https://www.excelbanter.com/excel-discussion-misc-queries/76899-running-macro-number-times.html)

JWF

Running a Macro a number of times
 
Hi
Jane from Portbury, nr Bristol (England) again
I have Office 2000 and XP
I don't know how to edit macros, VB language is a little too much for me -
but I can create them, use them and enjoy them.
I do lots of editing and often need to repeat keystrokes over and over
again, but once the file is finished never use the macro again so I tend to
save a macro to the keyboard, call it temp and run it using 2 keystrokes the
number of times I want the macro to run.
What I would like to be able to do is to run a macro say 5 times or 15 times
without hitting the 2 keystrokes the number of times required.
Hope this makes sense. I need this to work in Word as well.

Thanks
xJane

Gary''s Student

Running a Macro a number of times
 
Sub hello()
MsgBox ("hello")
End Sub


Sub times_three()
For i = 1 To 3
Call hello
Next
End Sub

times_three calls hello three times
--
Gary's Student


"JWF" wrote:

Hi
Jane from Portbury, nr Bristol (England) again
I have Office 2000 and XP
I don't know how to edit macros, VB language is a little too much for me -
but I can create them, use them and enjoy them.
I do lots of editing and often need to repeat keystrokes over and over
again, but once the file is finished never use the macro again so I tend to
save a macro to the keyboard, call it temp and run it using 2 keystrokes the
number of times I want the macro to run.
What I would like to be able to do is to run a macro say 5 times or 15 times
without hitting the 2 keystrokes the number of times required.
Hope this makes sense. I need this to work in Word as well.

Thanks
xJane


JWF

Running a Macro a number of times
 
Sorry Gary, this may work but I don't know what to do with it.
xJane

"Gary''s Student" wrote:

Sub hello()
MsgBox ("hello")
End Sub


Sub times_three()
For i = 1 To 3
Call hello
Next
End Sub

times_three calls hello three times
--
Gary's Student


"JWF" wrote:

Hi
Jane from Portbury, nr Bristol (England) again
I have Office 2000 and XP
I don't know how to edit macros, VB language is a little too much for me -
but I can create them, use them and enjoy them.
I do lots of editing and often need to repeat keystrokes over and over
again, but once the file is finished never use the macro again so I tend to
save a macro to the keyboard, call it temp and run it using 2 keystrokes the
number of times I want the macro to run.
What I would like to be able to do is to run a macro say 5 times or 15 times
without hitting the 2 keystrokes the number of times required.
Hope this makes sense. I need this to work in Word as well.

Thanks
xJane



All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com