Lock / Unlock cells depending on True / False

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi there,

I'm not sure why this code isn't working. Can someone tell me if I'm missing a trick please?

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A17") = "TRUE" Then
Range("F17:K17").Locked = False
ElseIf Range("A17") = "FALSE" Then
Range("F17:K17").Locked = True
End If
End Sub

Thank you!
 
So now I'm stuck on the data validation formula :rolleyes:
Currently when check box is selected A17 return TRUE and the period ending date shows up in C17. When selected, they can enter data in that row (E17:H17, J17). However, if they have not selected the check box, I want data validation to return an error if they start enter data in that row (cell E17 for example).
So I put this code in Custom Data Validation: IF(AND(A17=False,E17<>0)
I wrote an error message. However, this isn't working, as regardless of whether A17 = True or False, it won't let me enter data in E17 and comes up with the error message. Any idea please Fluff?
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,215,472
Messages
6,125,004
Members
449,203
Latest member
Daymo66

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