ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro from another X number of times (https://www.excelbanter.com/excel-programming/283616-run-macro-another-x-number-times.html)

BOHICA

Run Macro from another X number of times
 
okay then...I am looking for a way to make a macro that accesses
another macro as a sub routine according to a number in the selected
cell...

Example:
use active cell

run the following line (X)-1 times, X being the active cell value
Application.Run "'Data 10-25-03.xls'!NEWADDLOAD"

So, if the active cell has a value of 4, then the macro would execute
3 times the !NEWADDLOAD macro.

Okay, anyone have any ideas?

Thanks
-The Roach

mudraker[_38_]

Run Macro from another X number of times
 

for i = 1 to range("a1").value step 1
Application.Run "'Data 10-25-03.xls'!NEWADDLOAD
next i

or

for i = 1 to activecell.value step 1
Application.Run "'Data 10-25-03.xls'!NEWADDLOAD
next i


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Run Macro from another X number of times
 
if isnumeric(ActiveCell.Value) then
for i = 1 to ActiveCell.Value
Application.Run "'Data 10-25-03.xls'!NEWADDLOAD"
Next
End If


--
Regards,
Tom Ogilvy


BOHICA wrote in message
m...
okay then...I am looking for a way to make a macro that accesses
another macro as a sub routine according to a number in the selected
cell...

Example:
use active cell

run the following line (X)-1 times, X being the active cell value
Application.Run "'Data 10-25-03.xls'!NEWADDLOAD"

So, if the active cell has a value of 4, then the macro would execute
3 times the !NEWADDLOAD macro.

Okay, anyone have any ideas?

Thanks
-The Roach




BOHICA

Run Macro from another X number of times
 
Hey guys! Thanks for the help! Not only is it a dinky little macro,
but it works freaking perfect!!! WOOOOHOOOO! I have been away from
the programming scene for a while too...but I am re-learning fast
thanks to this group. Happy Thanksgiving to all! (For those who do
not believe in Thanksgiving, Happy Dayoff!)


All times are GMT +1. The time now is 06:01 PM.

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