How to call Macro specific Number of times

  • Thread starter Thread starter Legacy 185509
  • Start date Start date
L

Legacy 185509

Guest
Hi
I am trying to run a loop like 16 times
is there any way I can do it please help me
thank you so much
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hey Thanks for hint
how can I make my macro run till cell B3 has date of

09/30/2010

I want it to keep calling till date is 09/30/2010

thanks
 
Upvote 0
Try like this

Code:
Do Until Range("B3").Value = DateSerial(2010, 30, 9)
    Call MyMacro
Loop
 
Upvote 0
Thanks I haven't tried that, I'll try that, but intead I figured something else out but I need to know how to link cell into vba code
like this
is there anyway I link 22 from cell, 22 can be different everytime
like R1 it contain number 22, can I like there?
thank you
Code:
Sub Run()
For i = 1 To 22
Call Second_Run
Next i
End Sub
 
Upvote 0
Try like this

Code:
Sub MyRun()
For i = 1 To Range("R1").Value
    Call Second_Run
Next i
End Sub
 
Upvote 0
Oh man thanks
I didn't put .Value if wish I tried it, can you explain why put .Value
if you can :)
Thanks
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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