.unprotect causing objects to flicker/hide

aurelius89

Board Regular
Joined
Mar 15, 2017
Messages
69
Hi,

I have a very long sub that does multiple things. It is long, complex and sensitive so I cannot post it.

However, while the sub is running, all objects on my sheet disappear (Images, command buttons, etc)
They reappear when the sub has finished.

I have
Code:
application.screenupdating = False
at the beginning and
Code:
application.screenupdating = True
at the end. However, I have discovered that if the sub contains
Code:
.unprotect
to unlock another sheet, then this is actually the cause and the screen flicker and disappearing objects are still shown to the user and isn't covered by the screenupdating statements

It is the same issue as this person:
https://stackoverflow.com/questions...cker-despite-application-screenupdating-false

I am unable to find a resolution. Maybe you guys know one?
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Have you tried protecting the sheet(s) at workbook open with the Userinterfaceonly:=True argument? That will allow most code to operate without having to unprotect the sheets.
 
Upvote 0
Bingo! That works.

However, I guess pivot tables are one thing that it cant do?

I get the error "Cannot edit pivottable on protected sheet"

I have tried adding
Code:
AllowUsingPivotTables:=True
after the
Code:
[COLOR=#333333]Userinterfaceonly:=True [/COLOR]
argument but no joy.

It fails at this line:
Code:
Sheets("MySheet").PivotTables("MyPivot").PivotCache.Refresh
 
Upvote 0
Do you need to refresh the cache, or will refreshing the pivot table suffice? This should work:

Code:
Sheets("MySheet").PivotTables("MyPivot").RefreshTable
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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