Consulting

Results 1 to 6 of 6

Thread: [Application.ScreenUpdating = False] but screen still flickers...

  1. #1
    VBAX Regular cheapdrunk's Avatar
    Joined
    Mar 2006
    Location
    Brisbane
    Posts
    7
    Location

    Question [Application.ScreenUpdating = False] but screen still flickers...

    Hi all,

    okies... can anyone tell me why Excel flickers even with this simple macro?

    ThisWorkBook code:Dim AppClass As New EventClass

    Private Sub Workbook_Open()
    Set AppClass.App = Application
    End Sub
    TestModule code:
    Public Sub sheet_modified()
    Application.ScreenUpdating = False
    ' --- actual code goes here ---
    Application.ScreenUpdating = True
    End Sub
    EventClassModule code:
    Public WithEvents App As Application
     
    Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Call sheet_modified
    End Sub.
    please note: there would usually be code between the ScreenUpdating statements but for the purposes of testing I have omitted them.

    The problem I have is that even if screenupdating is turned off then immediately turned back on, my screen flickers whenever a sheet change happens!

    Has anyone else seen this?

    Dan
    Last edited by Aussiebear; 04-24-2023 at 12:50 AM. Reason: Adjusted the code tags

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I came across this recently. In effect the sheet has to change before the macro is triggered, hence a flicker.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    You also need to disable events and calculation to prevent the flicker, as some events force a screenupdate even when it is set to False.
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




  4. #4
    VBAX Regular
    Joined
    Mar 2006
    Posts
    44
    Location
    This came up in http://www.vbaexpress.com/forum/showthread.php?t=7393, but sadly no solution emerged.

    Sean.

  5. #5
    VBAX Regular cheapdrunk's Avatar
    Joined
    Mar 2006
    Location
    Brisbane
    Posts
    7
    Location

    Lightbulb thanks!

    Thanks everyone for your replies.

    I'll give disabling events and calculation a go but probably won't get a chance to do it until this weekend (really the ONLY time I get to do any programming these days...

    I'll message back with my findings!

    Dan

  6. #6

    Smile Disabling the event

    I was having the same issue, disabling the event fixed it for me. Thanks for your help

Posting Permissions

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