ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA macro pausing (https://www.excelbanter.com/excel-worksheet-functions/221938-vba-macro-pausing.html)

[email protected]

VBA macro pausing
 
Hi,
I have a macro that opens and closes several worksheets. However, the
macro does not work when run. However if I step thru it with the F8
function key, the macro works perfectly. I suspect I need to pause
the macro to allow it time to go to the various pages.
Question is how do I pause the macro in midstream, allow it time to
open and close the various pages and then continue with the remaining
instructions

Stefi

VBA macro pausing
 
See Wait Method in Excel Help!

Regards,
Stefi

ezt *rta:

Hi,
I have a macro that opens and closes several worksheets. However, the
macro does not work when run. However if I step thru it with the F8
function key, the macro works perfectly. I suspect I need to pause
the macro to allow it time to go to the various pages.
Question is how do I pause the macro in midstream, allow it time to
open and close the various pages and then continue with the remaining
instructions


Dave Peterson

VBA macro pausing
 
My bet is that the macro fails when you use a shortcut key to start it. If you
ran it via the tools|macro dialog or from a button, it would also run correctly.

If that's the case, I bet your shortcut key includes the shift key.

If that's the case, remove the shift key from that shortcut key combination.

If you have a workbook that has a workbook_open event or an auto_open procedure,
then if you open that file with the shift key held down, you stop those
procedures from running.

The shift-key in the shortcut combination confuses excel/vba to stop after you
open a file using one of those shortcut keys.



wrote:

Hi,
I have a macro that opens and closes several worksheets. However, the
macro does not work when run. However if I step thru it with the F8
function key, the macro works perfectly. I suspect I need to pause
the macro to allow it time to go to the various pages.
Question is how do I pause the macro in midstream, allow it time to
open and close the various pages and then continue with the remaining
instructions


--

Dave Peterson


All times are GMT +1. The time now is 01:19 AM.

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