Help needed with locking cell after 1 change is made to cell

andre4dee

New Member
Joined
Oct 21, 2005
Messages
21
this is the code i have but it aint workin , any suggestions ?

rivate Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Intersect(Target, Range("D16:L97")) Is Nothing Then Exit Sub
Select Case Target.Row
Case 16, 25, 34, 43, 52, 61, 70, 79, 88, 97
Target.Parent.Protect UserInterfaceOnly:=True
For Each Cell In Target
If Not IsEmpty(Cell) Then
Cell.Locked = True
End If
Next Cell
Case Else
Exit Sub
End Select
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
works fine for me.

It will only lock cells in this range D16:L97 and for these rows;
16, 25, 34, 43, 52, 61, 70, 79, 88, 97
 
Upvote 0

Forum statistics

Threads
1,214,627
Messages
6,120,610
Members
448,973
Latest member
ChristineC

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