Protecting Cells

ZacCerrato

Board Regular
Joined
Jun 2, 2010
Messages
76
I don't know much about the protection of cells in worksheets. I wonder if it is possible to allow a value to be entered into a cell, but to disallow users from deleting or changing that information?

The reason I am asking is that I have created a simple database to keep track of experiments done on objects. I have a main sheet where I have a unique, numeric ID assigned to each object. Each object has it's own row of basic, descriptive data on this main sheet. On multiple other sheets, I have this descriptive data of each object repeated by automatically generating from my first, main sheet using =vlookups. This way, we are not having to repeatedly type this information into our spreadsheets.

As I run experiments on these objects I am entering findings beside these numeric IDs (I have the descriptive data hidden). However, I realized that now there is no fail-safe/secure way to keep this data secure on other sheets. If someone were to accidentally delete or change the unique, numeric ID - all information identifying the object which was tested/experimented-on would be lost.

I want to both secure information that has been entered, but still allow for new entries to be entered easily.

Is there a simple way to allow a value to be entered into a cell, but to disallow users from deleting or changing that information once entered? Is there some clever sheet protection or cell protection function that I can use?

Thanks in advance for any responses.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You could start with something like this...

Right click on the Sheet Tab > View Code > Paste into the code module for that sheet.
Always try out new code on a copy of your workbook!

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target <> "" Then
        ActiveSheet.Unprotect Password:="MyPassword"
        Target.Locked = True
        ActiveSheet.Protect Password:="MyPassword"
    End If
End Sub

Be aware that Excel protection can help keep users from accidently overwriting locked cells-
however it doesn't provide a high level of security for your data.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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