Best way to Protect a spreadsheet

GMC The Macro Man

Board Regular
Joined
Mar 23, 2023
Messages
64
Office Version
  1. 2021
Platform
  1. Windows
Hi guys,
I'm trying to find the best way to protect a spreadsheet and looking to see what others use.
I have a spreadsheet with 1 worksheet for the users to input their data followed by up to 10 worksheets that use the data to create reports and dashboards etc.
I only want the users to see the value on the dashboards, I don't want them to see the formula in the formula bar at the top and I don't want them to be able to make changes so I under FORMAT I use the Protect Sheet and give it a password, I also make sure the cells are Locked & Hidden.
Is his the best way to do this?
Also, is there an easier way to unprotect / protect multiple sheets at once as it's a pain if I have to make changes

Thanks as always
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Your method to protect and hide the formulae seems good.

As for ptotect/ unprotect multiple sheets, you could write a macro for that and then lock the VBA in the spreadsheet?
 
Upvote 0
Solution
Thanks Georgiboy, appreciate your time in replying to my question. I will look at the VBA option for the protection on Multiple sheets
 
Upvote 0
Maybe the below will help with that, it will protect all sheets if not protected or unprotect if they are:
VBA Code:
Sub ProtectUnprotect()
    Dim ws As Worksheet, pwd As String
    
    pwd = "password"
    
    For Each ws In Sheets
        If ws.ProtectContents Then
            ws.Unprotect pwd
        Else
            ws.Protect pwd
        End If
    Next ws
End Sub

You could exclude a sheet as below if needed:
VBA Code:
Sub ProtectUnprotect()
    Dim ws As Worksheet, pwd As String
    
    pwd = "password"
    
    For Each ws In Sheets
        If ws.Name <> "Sheet1" Then
            If ws.ProtectContents Then
                ws.Unprotect pwd
            Else
                ws.Protect pwd
            End If
        End If
    Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,090
Latest member
fragment

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