VBA - can I stop screen updating when activating different workbooks?

TomCon

Active Member
Joined
Mar 31, 2011
Messages
373
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have set

Application.ScreenUpdating = False


And, it turns off screen updating except for one thing. When i activate a different workbook (with Windows(bo).Activate) the screen changes to that different workbook. Since this is within a loop, it is happening many times.

And, this tremendously slows down the macro execution, which is what I was trying to eliminate by setting ScreenUpdating=False in the first place. Is there a more thorough way to turn off ALL screen updating so this macro can execute faster and will not show changing windows when it hits the Windows.Activate statement?

Thank you.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Why do you need to activate the other workbook?
 
Upvote 0
Copying a whole bunch of info from one workbook to another. Maybe it could be designed more efficiently...however, just wanted to write a few quick and dirty lines of code and let the processor do the work. Was disappointed that Application.ScreenUpdating=False seems to have this 'exception'. So, back to the question, is there any way to "truly" turn off screen updating? I envision Excel sitting there and the screen doing absolutely nothing until the macro ends. Possible?
Thanks!
 
Upvote 0
There is no need to activate a workbook to copy data to it from another workbook. Do away with the activate and you don't have the issue and so not the question.

And yes there has been code for a better screenupdating but "write a few quick and dirty lines of code" it isn't
 
Last edited:
Upvote 0
Thanks very much! I thought i had to activate the book in order to provide "context" for the destination cell. But, as you say, this is not necessary; full context can provided as:
Workbooks(bnw).Sheets(sht).Range(addr).Formula = ftxt (as you know). Even when the active workbook is not that workbook.

This did speed it up...although less than i had hoped. Maybe by about 25%.

I have a "highly corrupted" workbook i am trying to recover, and so i want to try copying everything as text, not any copy of cell formulas or cell contents, so that i can see if i can recreate the workbook that way. "open and recover" nor anything else have worked. I have charts and PivotTables too, so it is going to be a long process to recover.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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