ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Screen Updating (https://www.excelbanter.com/excel-programming/445190-screen-updating.html)

vom[_2_]

Screen Updating
 

Hi all,
I have a macro that is called from another that includes the following
2 lines at the start

Application.ScreenUpdating = False
Sheet3.Activate
code here

Everytime this runs the screen jumps from another worksheet to Sheet3.
Is there any way to stop this from happening?


Gord Dibben[_2_]

Screen Updating
 
Depends where you go after you activate Sheet3 and do your stuff.

If you go from Sheet4 over to Sheet3, do something then come back you
will never see Sheet3

Application.ScreenUpdating = False
Sheet3.Activate
For Each cell In ActiveSheet.Range("A1:A45")
cell.Interior.ColorIndex = 6
Next
Sheet4.Activate

But, there is rarely any reason to activate a sheet or select things.

The above can be written without any screenupdating=false or
activations

For Each cell In Sheet3.Range("A1:A45")
cell.Interior.ColorIndex = 6
Next

Show us your "code here"


Gord

On Thu, 15 Dec 2011 01:47:07 +0000, vom
wrote:


Hi all,
I have a macro that is called from another that includes the following
2 lines at the start

Application.ScreenUpdating = False
Sheet3.Activate
code here

Everytime this runs the screen jumps from another worksheet to Sheet3.
Is there any way to stop this from happening?


Ron Rosenfeld[_2_]

Screen Updating
 
On Thu, 15 Dec 2011 01:47:07 +0000, vom wrote:


Hi all,
I have a macro that is called from another that includes the following
2 lines at the start

Application.ScreenUpdating = False
Sheet3.Activate
code here

Everytime this runs the screen jumps from another worksheet to Sheet3.
Is there any way to stop this from happening?


Delete the sheet3.activate line

Ron Rosenfeld[_2_]

Screen Updating
 
On Thu, 15 Dec 2011 01:47:07 +0000, vom wrote:


Hi all,
I have a macro that is called from another that includes the following
2 lines at the start

Application.ScreenUpdating = False
Sheet3.Activate
code here

Everytime this runs the screen jumps from another worksheet to Sheet3.
Is there any way to stop this from happening?


Hit <enter too soon.

Deleting the sheet3.activate line would keep that from happening, but might have deleterious effects on the rest of the code, if it depends on the sheet being activated. It is unusual for VBA to require the sheet to be activated, so the subsequent code could probably be rewritten to deal with particular worksheets and ranges, rather than an activated sheet.


All times are GMT +1. The time now is 12:16 AM.

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