ScreenUpdating = False doesn't seem to be working

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
866
Office Version
  1. 365
Platform
  1. Windows
Hi
When this macro runs, the screen flickers as if the ScreenUpdating = False is not working. I can see the screen sorting and then finding the last row.
I also put in both ScreenUpdatings in the 2 marcos that run after the Freeze Pans runs
I tried taking them out of the macros, but I still get the flickering.
I also ran each macro separate and I get the screen moving
Excel Formula:
Private Sub Worksheet_activate()
Range("A3").Select
ActiveWindow.FreezePanes = True
Application.ScreenUpdating = False
sortnew
lastrow
Application.ScreenUpdating = True
End Sub
Am I using the updating wrong?
It works in other workbooks and worksheet.

Mike
 
You are calling Subs sortnew and lastrow and we have no idea what is in those. You need to show us the entire tree of subordinate sub code.
 
Upvote 0
This should not be related to your problem, Jeff is on top of that, but since we all try to eliminate selecting, you can change this
Code:
Range("A3").Select
ActiveWindow.FreezePanes = True
to this
Code:
Sub Freeze_Row3()
With ActiveWindow
    If .FreezePanes Then .FreezePanes = False
    .SplitRow = 3
    .FreezePanes = True
End With
End Sub
 
Upvote 0
I also put in both ScreenUpdatings in the 2 marcos that run after the Freeze Pans runs
That would certainly cause the problem since setting it to True will cause the screen to redraw.
 
Upvote 0
Solution
... you can change this
Code:
Range("A3").Select
ActiveWindow.FreezePanes = True
to this
Code:
Sub Freeze_Row3()
With ActiveWindow
    If .FreezePanes Then .FreezePanes = False
    .SplitRow = 3
    .FreezePanes = True
End With
End Sub
Just noting that they do not really produce the same result.
With the former, if Freeze Panes is subsequently removed a 'normal' worksheet returns.
With the latter, if Freeze Panes is subsequently removed, the sheet retains the SplitRow.
 
Upvote 0
Re: "the sheet retains the SplitRow."
No it does not. If you use split row in one, you should use it it the other.
Code:
With ActiveWindow
    .SplitRow = False
    If .FreezePanes Then .FreezePanes = False
End With
 
Upvote 0
I would like to thank all of you for your responses.
I wish I could clink on more than one check mark.
I understand what Rory means. both sub macros had the cursor end up at the last row. after the sortnew macro ended ,the cursor went to the last row. then the the last row mad the cursor move before the screen froze.
I had written these macros as a stand alone because I have a icon on the ribbon to run them. I also wanted to have them run when the sheet opened.
I will re-write the open/activate macro and keep the cursor from having to move.

Again, thank you all for your replies.

mike
 
Upvote 0
No it does not. If you use split row in one, you should use it it the other.
In the original post there was no "other" code & my thinking was that a user (who may well not be the writer of the code) might just use the ribbon button options to Unfreeze Panes and in that case the sheet does still retain the split row - at least it does for me.
 
Upvote 0

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