VBA to Allow Updating of Cells on Protected Sheets

PShingadia

New Member
Joined
Aug 5, 2015
Messages
47
Hi All:

I have three reporting sheets with a drop-down on each from which a user can make a selection. This selection then updates calculations on that sheet. However, when these sheets are protected the cells will not update and Excel shows message 'You are trying to update values on a protected sheet....'.

I have the following VBA code in the Workbook part but will not work.

Private Sub WorkbookPrav_Open()
With Worksheets("Total Summary by Lot")
.Protect contents:=True, userinterfaceonly:=True
.EnableOutlining = True
End With

With Worksheets("Summary Pricing Report")
.Protect contents:=True, userinterfaceonly:=True
.EnableOutlining = True
End With

With Worksheets("Summary by Vessel")
.Protect contents:=True, userinterfaceonly:=True
.EnableOutlining = True
End With

End Sub


Please help as have been trying for a whole day to sort this out.

Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You can unprotect the sheet then protect the sheet again.

If you do not have a password then leave that off

Code:
Sheets("Total Summary by Lot").Unprotect "password"

Sheets("Total Summary by Lot").Protect "password"
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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