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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

jimboy

Well-known Member
Joined
Apr 11, 2002
Messages
2,314
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
 

Watch MrExcel Video

Forum statistics

Threads
1,130,307
Messages
5,641,442
Members
417,209
Latest member
Agbarker

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
Top