We are in the process of updating the site, so some pages still have the older design.

Pause a Macro or Make it Slow Down in Excel

Download Project Files
Author:

How to make a macro stop or pause for a specified amount of time.

This allows you to slow down the execution of a macro.

Method 1 - Simple but Not Versatile

Add this line of code anywhere in your macro where you want it to pause.

Application.Wait(Now + TimeValue("00:00:01"))

This will pause the macro for 1 second.

The first set of zeros is hours; the second set is minutes; the third set is seconds.

Method 2 - More Work but Better - Fractions of Seconds

Sometimes you need to pause a macro for a fraction of a second and, for this, we need to do something else.

Put this piece of code at the top of your module:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

It would look like this:

Notice that it was put above the first Sub in the module.

Then, make the macro stop or pause using this method:

Sleep(1000)

This is in milliseconds, so 1000 equals 1 second, 2000 equals 2 seconds and anything less than a thousand is a fraction of a second.

Both Methods in the VBA Editor

Notes

Both methods have their place; use whichever one works best for you.

Download the sample file attached to this tutorial to see these macros in Excel.

Download the Project Files

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use

Downloadable Files: Project File

Download Project File

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Make Users Enable Macros in Order to View a Workbook in Excel
Tutorial: Tutorial showing you how to make a user enable macros in a workbook in order to view the w...
Minimize or Maximize the Ribbon Menu in Excel
Tutorial: This is a simple way to get more space in Excel, reduce clutter, and streamline the inte...
Round Numbers Up or Down in Excel
Tutorial: How to round a number up or down and also to a specified number of decimal places in Excel...
Increment a Value Every X Number of Rows in Excel
Tutorial: (New Easier Version for Excel 2010 and Later) How to increment a value, number, percent, e...
Delete Blank Rows in Excel
Macro: This is a macro which will delete blank rows in excel. This version will delete an entire ...
Generate a Non-Repeating List of Random Numbers in Excel - UDF
Macro: Generate a series of non-repeating random numbers in Excel with this UDF (user defined fun...
Tutorial Details
Downloadable Files: Project File

Download Project File

Follow along with the tutorial by downloading the files used in it. (Completely Free)

Phone number is optional - we use it to send course discounts and weekly updates via SMS.

SMS Terms ▾
By submitting this form, you agree to receive recurring automated marketing text messages from TeachExcel at the mobile number provided. Consent is not a condition of any purchase. Msg frequency varies. Msg & data rates may apply. Reply HELP for help or STOP to cancel at any time.

View our Privacy Policy | Terms of Use
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course