Spreadsheet does not populate until VBA procedure ends.

GCWesq

New Member
Joined
Feb 27, 2014
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Spent most of the day on this.
I have a procedure which opens a worksheet, copies data from it, and pastes the data into another worksheet.

This works fine if I open and close the first worksheet. It also works properly if I step through the code using F8. :)

But it doesn't work properly (see below) if I don't open the worksheet, but just read from it - using code from here:
Excel VBA – Read Data from a Closed Excel File or Workbook without Opening it :mad:

THE PROBLEM is that the cells in the target worksheet don't show the pasted values until the VBA procedure ends. :unsure:
This would be OK, but I want to check the pasted data BEFORE proceeding with the rest of the procedure. To do this checking, I have put in a yes/no MsgBox. If I say NO, the cells don't populate until AFTER I have clicked on NO, which, of course, is too late. I want to be able to see the data before deciding if it's OK, as you can imagine. :confused:

I have tried the wait function (Application.Wait - same thing happens after the time has elapsed), I have tried putting other code ahead of the MsgBox, I have tried putting the MsgBox in a separate Sub, and possibly other things, but to no avail.

Any help would be greatly appreciated.

Thanks.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
copy it first to an auxiliary worksheet and if later, you agree, copy it to the desired range.
 
Upvote 0
Thanks, BSALV.
However, I'm trying to avoid opening an extra sheet. Otherwise, I can just open the source document, which does work, as noted.
 
Upvote 0
Try reactivating screen updating at the point in the procedure where you want to check it.
 
Upvote 0
Solution
With a single stroke of the pen typewriter keyboard, he wipes away eight hours of desperate sweat and tears!
Many thanks, jasonb75. That did it!!!
As Rocky said to Mugsy in a famous Bugs Bunny episode: "I don't know how yuz dunnit, but I know yuz dunnit!"
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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