vba to stop screen flickering when code running

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
680
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have the code below with the usual Application.ScreenUpdating incorporated but the screen still flashes/flickers when the code runs - everything (charts/tables etc.) momentarily disappear and re-appear when it runs so it doesn't look very slick. The page has a couple of charts reading from other sheets, some tables with formulas, text boxes reading from other sheets and some combo boxes being used as dropdowns. I'm using Excel 2016.
Any thoughts?

Code:
Private Sub ComboBox7_Change()


On Error GoTo errHandle:
    
    Application.ScreenUpdating = False
    
    Sheet8.Unprotect Password:="pass1"
    Sheet17.Visible = True
    Call Macro41
    Sheet17.Visible = xlVeryHidden
    Sheet8.Select
    Range("R22").Select
    Sheet8.Protect Password:="pass1"


    Application.ScreenUpdating = True
    
errHandle:


End Sub
 
Hi, Thanks for your continuing help with this.
I replaced my code with your code and it stops at the beginning of Macro41 with the following highlighted Set ws = Sheet17 (am guessing cos Sheet17 is still hidden?)
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi, Thanks for your continuing help with this.
I replaced my code with your code and it stops at the beginning of Macro41 with the following highlighted Set ws = Sheet17 (am guessing cos Sheet17 is still hidden?)

I don't think so. I tried running the code and do copy/pastes with the sheet as xlSheetVeryHidden and it worked fine. Try to see if the sheet is still called Sheet17 in your VBA project.
What is the error message that was prompted ?

Btw i did a little mistake and put

Code:
Dim ws As Worksheet[U]s[/U]
instead of
Code:
Dim ws As Worksheet

Maybe you copied the code before i corrected it :biggrin:
 
Last edited:
Upvote 0
Ok, have redone your code again from fresh and it works however; (a) I needed to re-introduce Sheet8.Unprotect Password:="pass1" as my charts won't update in Sheet8 unless I do this, and (b) it still flickers sadly.
 
Upvote 0
just for clarity, Sheet8 doesn't 'flicker' as it runs through the macro it 'flashes' off/on briefly at the end of the macro (everything disappers then re-appears)
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,016
Members
449,414
Latest member
sameri

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