+ Reply to Thread
Results 1 to 16 of 16

Screen Flickers Even with Application.ScreenUpdating set to False

  1. #1
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Screen Flickers Even with Application.ScreenUpdating set to False

    I have a very simple piece of code that will divert the selected cell to cell A1 (hidden behind a logo) so that the users will not see the frame of a selected cell, making this tool look less like an Excel file and more like a normal software program. This sub sits in a normal worksheet (not in modules folder or ThisWorkBook part of the VB code).

    The problem is that the screen flickers 2-3 times for each click on the worksheet even with the ScreenUpdating value set to False. It behaves exactly the same even if I comment out the statement that turns ScreenUpdating back to True. Does anybody know why? Thank you in advance for your help!

    Please see code below:

    Please Login or Register  to view this content.
    ~ M3atball
    Last edited by m3atball; 10-12-2010 at 12:20 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    You can't Select if you don't want the screen to update.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    shg -

    Thanks for the quick reply!

    I change the statement to Activate and it still flickers. Did you mean that I shouldn't be use the WorkSheet_SelectionChange() event? I cannot think of other ways to detect a user's mouse click.

    Thanks!

    Please Login or Register  to view this content.
    ~ M3atball
    Last edited by m3atball; 10-12-2010 at 12:20 PM.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Hi m3atball

    You'll get "Screen Flicker" when you use "Select" or "Activate"because the cursor is physically moving. That's the "Flicker" you see. To avoid the "Flicker', use the "With...End With" convention.

    I think.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Why not lock the sheet so they can't select anything?
    Remember what the dormouse said
    Feed your head

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    John,
    What does With...End with have to do with screen flicker? All it does is hold a reference to an object, so you can perform multiple operations on it without having to refer to it each time.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Hi romperstomper

    You know, I don't really know, that's why I said
    I think.
    It's my limited experience that when you use With...End With, you're neither Selecting nor Activating so that you're not moving the cursor thus causing Screen Flicker. Not true?

    In re-reading the OP's query, I must confess I don't see how this apples to the post.

    I appreciate ANY feedback that adds to my education.

    John

  8. #8
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Hi John and romperstomper -

    Thanks for the replies! Sorry I didn't get a chance to work on this for the past few days.

    @romperstomper - You're so right! My sheet has always been locked/protected but now I've de-selected the checkboxes so that user cannot select any cells. That totally solve the problem! Woohoo!

    @John- I'll keep your comments in mind and use With...EndWith another time on some other sheet. Since the original question was on reacting to user clicking, the cursor movement is a given rather than some backend cell movement that I can control. I do see your point by referencing without activating/selecting though.

    However, isn't ScreenUpdating supposed to take care of this flickering anyway? Or does it only work when you flip between different worksheets but not when the same sheet is refreshed? It definitely works on on all other parts of my code to prevent flipping across different worksheets.

    Thanks again!

    M3atball

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Turning screenupdating off (generally) prevents the screen being redrawn while your code is running but it has to get redrawn at the end so, if you changed the active sheet in some way, such as switching cells, you will appear to get a little flicker.

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Quote Originally Posted by jaslake View Post
    It's my limited experience that when you use With...End With, you're neither Selecting nor Activating so that you're not moving the cursor thus causing Screen Flicker. Not true?
    John,
    Sorry, I missed this post.

    The two things are not actually related although it is true that you often see parallels. Consider the following 4 examples and hopefully you will see:
    One:
    Please Login or Register  to view this content.
    Two:
    Please Login or Register  to view this content.
    Three:
    Please Login or Register  to view this content.
    Four:
    Please Login or Register  to view this content.
    They all achieve much the same thing, but two do it without selecting. As you can see, the With...End With is not required for that. It is only really useful if you are performing multiple operations on the same object - in example 4 it serves no real purpose at all.

    Does that make sense?

  11. #11
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Quote Originally Posted by romperstomper View Post
    Turning screenupdating off (generally) prevents the screen being redrawn while your code is running but it has to get redrawn at the end so, if you changed the active sheet in some way, such as switching cells, you will appear to get a little flicker.
    romperstomper -

    Thanks for the clarification!

    ~ M3atball

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    krishnap2w2, I have removed your link, we do not allow links to commercial sites here. If you want to offer your (free) services and help here, then we welcome you. If you are just trying to advertise your business, then I would ask that you look for alternative vanues

    I have included the basis of your pdf file below...

    This article helps to handle the screen updates using macro. We can speed up
    our macro by turning off the screen updating while the macro runs, by adding the
    below line of code to the macro:
    Sub Macro ()
    Application.ScreenUpdating = False
    Write the necessary code Here
    ——————-
    ——————-
    Application.ScreenUpdating = True
    End Sub.


    The prior versions of excel 2000, it was not required to turn Screen Updating back to true. When the macro is finished, Excel would revert back to turning the screen updating to true.
    But now whether you are writing macros in Excel 97, Excel 2000, Excel 2002, 2003, 2007 or 2010 always we have to turn the screen updating back to true with the below code:
    Application.ScreenUpdating = True
    Thanks for that tip
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Quote Originally Posted by FDibbins View Post
    Thanks for that tip
    Shame it's incorrect though.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Thanks for the update on that, Rory

  15. #15
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    We know. You already posted that thinly-veiled spam and Ford deleted it once...

  16. #16
    Registered User
    Join Date
    09-27-2014
    Location
    Ridgefield, CT
    MS-Off Ver
    2010, 2013
    Posts
    1

    Re: Screen Flickers Even with Application.ScreenUpdating set to False

    Protecting/unprotecting a sheet activates the sheet (2013+), despite Application.ScreenUpdating=False. This was the cause of my flicker.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1