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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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