How can I stop all workbook sheets being shown when unprotect code runs

QualEng

New Member
Joined
Aug 15, 2018
Messages
13
I have a workbook with a large number of sheets (100+) Ihave a button for administrator/high level user use which unprotects the wholeworkbook which works OK, BUT when the code runs it shows/flashes through allthe sheets as they are being unprotected which is very annoying (and may evenbe a H&S issue for epilepsy sufferers).
How can I stop the sheets showing when are beingunprotected.

Any help will be very welcome!
Thanks
SubMacroUnP()
'Passwordfor unprotecting all in workbook
Dim Str As String
Str = InputBox("Enter Password")
If Str = vbNullString Then
MsgBox ("User canceled!")
End If
If Str = "0857" Then
Call UnprotectWorkbook
End If
End SubAll workbook sheets flashing

 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Have you tried to use

Application.ScreenUpdating=False

at the start of the process and then

Application.ScreenUpdatng=True

at the end?
 
Upvote 0
HI
Thanks but I just tried that but it didn’t work see code anderror message have I placed new lines in the correct position?


Sub UnprotectWorkbook()
Application.ScreenUpdatng = False
Dim wsheet As Worksheet
For Each wsheet In ActiveWorkbook.Worksheets
wsheet.Unprotect password:="0159"
Next wsheet
Application.ScreenUpdatng = True
End Sub

Run-time error ‘438’:
Object doesn’t support this property or method

 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,178
Latest member
Emilou

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