Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Pausing a macro

I have a workbook where I select a file to open, from a list on my
worksheet, and then I press a command button to open the file selected.
However when selecting the file, a calculation takes place and if I
press the command button before the calculation is finished, I get an
error message. If I could get about a 5 second pause after pressing
the command button, the calculation will then be finished before the
macro runs.

How do I do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Pausing a macro

Application.Wait(Now + TimeValue("0:00:5"))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
I have a workbook where I select a file to open, from a list on my
worksheet, and then I press a command button to open the file selected.
However when selecting the file, a calculation takes place and if I
press the command button before the calculation is finished, I get an
error message. If I could get about a 5 second pause after pressing
the command button, the calculation will then be finished before the
macro runs.

How do I do this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Pausing a macro


You don't say what kind of calculations or why it is trigged by the
selection how, but try something like

Private Sub CommandButton1_Click()
Application.Calculate
DoEvents
'rest of code here
End Sub

HTH. Best wishes Harald

skrev i melding
ups.com...
I have a workbook where I select a file to open, from a list on my
worksheet, and then I press a command button to open the file selected.
However when selecting the file, a calculation takes place and if I
press the command button before the calculation is finished, I get an
error message. If I could get about a 5 second pause after pressing
the command button, the calculation will then be finished before the
macro runs.

How do I do this?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Pausing a macro


Bob Phillips solution resolves the problem. Thank for the help and to
all who replied.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pausing a macro Alex.W Excel Discussion (Misc queries) 2 August 10th 07 11:30 AM
Pausing Macro Patches New Users to Excel 2 March 28th 07 03:00 AM
Pausing a Macro PaulW Excel Discussion (Misc queries) 0 May 30th 06 02:05 PM
pausing a macro Hasan Cansü[_2_] Excel Programming 6 February 27th 04 06:40 PM
Pausing a VBA macro Dean Taylor Excel Programming 1 August 1st 03 05:44 PM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"