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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,764
Messages
6,180,839
Members
453,000
Latest member
JAO Esq

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