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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,071
Messages
5,835,216
Members
430,347
Latest member
Mayan

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