Macro Doesn't Run Automatically

matthewlouis

Active Member
Joined
Mar 28, 2014
Messages
374
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Several months ago, I had some help creating the following macro.

Sub clicky()
For t = 1 To 100
Application.Calculate
Range("J10").Value = Range("J10").Value + 1
If Range("F11").Value <= 0.8 Then Range("J12").Value = Range("J12").Value + 1
Debug.Print t & ":" & Range("F11")
MsgBox t
Next t
End Sub

The macro works well except for one thing. It doesn't run automatically. When I hit CTRL-Shift-C, I want it to run the macro automatically 100 times. However, I am having to hit the Esc button each time to run ONE simulation, or 100 times to complete it. Am I missing a line in the code? I circled back to the person who helped write this code but I never heard back from him . . . it's been 3 months . . . so I hope the moderators understand this isn't a re-post.

Thanks in advance!


Several months ago, I had some help
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Just to clarify:
The macro runs once means 100 simulations, since the macro is designed to loop 100 times.
 
Upvote 0
Could you please redo that image including Row and column denominator?
What is the content of cell F11?
 
Upvote 0
Just to clarify:
The macro runs once means 100 simulations, since the macro is designed to loop 100 times.
To be honest I thought so too, but from a distance some things are very difficult to judge.
 
Upvote 0
To be honest I thought so too, but from a distance some things are very difficult to judge.
It's hard to dig into. The information is scarce.
Best thing would be to have the whole xlsm-file at hand to get a detailed look.
As far as the posted part of the code is concerned, just nothing is calculated but only the simulations are counted up.
 
Upvote 0
This sheet has multiple links to other worksheets with market data. All linked.
 
Upvote 0
81.png
82.png
 
Upvote 0
One thing is for certain: the MsgBox t has no influence except that it stops the macro and displays the value of t in a messagebox that needs Esc or Enter to be closed in order to continue the macro.

I do not understand the 68 in cell J12 since in your code J12 is never changed, therefore I begin to doubt the validity of the whole calculation.
Please post the contents of cell J12: is it a formula or just a value?

The 232 seems to be cell J14?
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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