+ Reply to Thread
Results 1 to 8 of 8

Can Excel run vba without updating the screen or causing it to flicker?

  1. #1
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Can Excel run vba without updating the screen or causing it to flicker?

    Is there a way to have Excel perform a task using vba such as sorting a column, but do it in the background so you don't see it happening? I can see the flicker as Excel jumps from my current location to the column it needs to copy, and then paste and sort to the adjacent column, and then proceed to jump back. It happens quick, but it's just annoying to me to see that faint flicker every time. I'm hoping there is a function/command I can add to the macro that will still process the code, but maybe not update the screen during that split second.

    Hope that makes sense!

    This is the code I'm using:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Can Excel run vba without updating the screen or causing it to flicker?


    As selecting is very often useless, to avoid ! For example instead of your two first codelines : Range("BS4:BS51").Copy

    See also ScreenUpdating property in VBA inner help.

  3. #3
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    Quote Originally Posted by Marc L View Post

    As selecting is very often useless, to avoid ! For example instead of your two first codelines : Range("BS4:BS51").Copy

    See also ScreenUpdating property in VBA inner help.
    Not sure what you meant by your first line, but the ScreenUpdating command worked great! Thanks!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,288

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    Marc L means...Replace this...
    Please Login or Register  to view this content.
    With...
    Please Login or Register  to view this content.
    Always avoid Select or Activate...
    Last edited by sintek; 06-02-2019 at 03:06 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    Or instead of this
    Please Login or Register  to view this content.
    you can use this
    Please Login or Register  to view this content.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    To summarize.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    Thanks for the clarification; I figured there had to be a better way.

  8. #8
    Registered User
    Join Date
    06-03-2019
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Can Excel run vba without updating the screen or causing it to flicker?

    You can put this in the beginning of your code:

    Application.ScreenUpdating = False 'hides what happens
    Application.Calculation = xlCalculationManual 'excel doesn't save

    At the end of the code this is inserted:

    Application.Calculation = xlCalculationAutomatic 'Turns on the calculation again
    Application.ScreenUpdating = True shows what's happening again
    DoEvents
    Application.Calculate
    DoEvents

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Word screen flicker prevent
    By mitrozo in forum Word Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2016, 08:14 PM
  2. Excel 2016 screen flashing between two workbooks despite screen updating turned off
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2016, 03:07 PM
  3. Screen Flicker - EXCEL 2013 Only
    By A_Pass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-19-2014, 11:31 AM
  4. Screen Flicker
    By BuzzT in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-07-2011, 11:22 AM
  5. Help stopping screen flicker due to ComboBox
    By mikeyt354 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-13-2010, 04:08 PM
  6. screen flicker
    By mark kubicki in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2005, 09:06 PM
  7. [SOLVED] Preventing screen flicker
    By Paul in forum Excel General
    Replies: 2
    Last Post: 03-15-2005, 06:06 PM

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