Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make my vba wait?

Hi all,

I have a VBA query which refreshes a workbook and then saves it, then it
changes a particular cell value and then saves it somewhere else.

Unfortunately, the first save hasn't finished before it changes the
particular cell value, so the first save is incorrect.

How can i make the vba understand i want it to wait until the previous line
of code has finished before starting the next bit?

Thanks
Emma
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Make my vba wait?

Try this

'refresh query
DoEvents

"Emma Hope" wrote:

Hi all,

I have a VBA query which refreshes a workbook and then saves it, then it
changes a particular cell value and then saves it somewhere else.

Unfortunately, the first save hasn't finished before it changes the
particular cell value, so the first save is incorrect.

How can i make the vba understand i want it to wait until the previous line
of code has finished before starting the next bit?

Thanks
Emma

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Make my vba wait?

Hi
Put in

DoEvents

after the saves. Handy if you have anything updating the screen (e.g
charts or cell values) within code.
regards
Paul

On Jun 11, 12:15*pm, Emma Hope
wrote:
Hi all,

I have a VBA query which refreshes a workbook and then saves it, then it
changes a particular cell value and then saves it somewhere else.

Unfortunately, the first save hasn't finished before it changes the
particular cell value, so the first save is incorrect.

How can i make the vba understand i want it to wait until the previous line
of code has finished before starting the next bit?

Thanks
Emma


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make my vba wait?

this works fine after the save but not with the refresh.....


" wrote:

Hi
Put in

DoEvents

after the saves. Handy if you have anything updating the screen (e.g
charts or cell values) within code.
regards
Paul

On Jun 11, 12:15 pm, Emma Hope
wrote:
Hi all,

I have a VBA query which refreshes a workbook and then saves it, then it
changes a particular cell value and then saves it somewhere else.

Unfortunately, the first save hasn't finished before it changes the
particular cell value, so the first save is incorrect.

How can i make the vba understand i want it to wait until the previous line
of code has finished before starting the next bit?

Thanks
Emma



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
sendkeys(keys,wait) how do I use wait MM Excel Discussion (Misc queries) 1 February 11th 09 03:47 PM
Make VBA wait for return from external function Gib Bogle Excel Programming 8 January 3rd 09 03:42 AM
Make onTimer wait until Excel finish database request? news.stofanet.dk Excel Programming 2 March 4th 07 08:36 PM
Help with Wait X Then Go Ikaabod[_17_] Excel Programming 0 April 25th 06 05:04 PM
Wait less than a second Claus[_3_] Excel Programming 3 September 7th 05 01:25 PM


All times are GMT +1. The time now is 10:02 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"