Adding pauses to a macro

Sweedler

Board Regular
Joined
Nov 13, 2020
Messages
132
Office Version
  1. 365
Platform
  1. Windows
Hello

Sub New_country_Click()

Dim i As String
Dim w As Long
Dim v As Long

Range("P5").Formula = "=XLOOKUP(1,I:I,B:B,"""",0)"
w = 50000

Application.CalculateFullRebuild
For v = 1 To w
Next v
Application.CalculateFullRebuild
For v = 1 To w
Next v
Application.CalculateFullRebuild
For v = 1 To w
Next v
Application.CalculateFullRebuild
For v = 1 To w
Next v
Application.CalculateFullRebuild

i = Range("P5")
Range("P5") = i

End Sub


I am currently using the following. Each time "CALCULATEFULLREBUILD" is the "xlookup" formula present a name in cell P5. I want this process to cycle 5-10 times, but I need there to be a pause so that the name in P5 can be registered. I basically want it to look like it is cycling through a selection of names before it settles with the final one. That is when the value is copied in so that it does not change anymore.

Please help
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Thank you all for your input:

Here is how I solved my issue in the end.
Sub New_country_Click()

Dim i As String
Dim f As Integer

For f = 3500 To 1 Step -1

Range("P5").Formula = "=XLOOKUP(1,I:I,B:B,"""",0)"
Next f

i = Range("P5")
Range("P5") = i

End Sub


The Italic loop in the middle does what I wanted it to do. In cell P5 I am showing the value from column B, that in column I has the value 1. Column I gets its values from a series of random number generators. So what this Macro now does is cycle through some names that is quickly shows in cell P5 before settling for the 1 country.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

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