Lock Cells (only specific cell) once entered data

deepak_4you

New Member
Joined
Dec 29, 2010
Messages
17
Hi,

Can anyone tell how to do this -

My worksheet has 4 columns which are for customers to update on shared excel file, rest all i have locked with password.

Now what i want is when anyone enter data into any cell in these 4 columns that particular cell got locked, leaving other cells of that columns unlocked for other customers, & this continues whenver anyone enters data into any cell it goes locked.

Regards

Deepak Sharma:confused:
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi Deepak Sharma,

Start by formatting all the cells on the worksheet to be unlocked

Then you can add the code below.
Always try out new code on a copy of your workbook!

Right click on the Sheet Tab > View Code > Paste into the code module for that sheet.
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("A:D")) Is Nothing Then
        With Intersect(Target, Columns("A:D"))
            ActiveSheet.Unprotect Password:="MyPassword"
            .Locked = True
            ActiveSheet.Protect Password:="MyPassword"
        End With
    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,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

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