Locking cells

EDMONd

New Member
Joined
Jan 19, 2005
Messages
30
I am trying to lock cells E10-E40 untill cell J4 has an entry greater than 3. I sure could use some help.
Thanks
EDMONd
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello, Edmond,

WELCOME to the Board !!!

Really locking or is data validation good enough?

select your range
menu data / validation
choose custom
type in the formulabox
=$J$4>3

is this OK for you?

kind regards,
Erik

(EDIT: just saw it was you first post, so added "WELCOME to the Board !!!")
 
Upvote 0
If the cells are locked to start with:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Application.EnableEvents = False
    If Target.Address <> "$J$4" Then GoTo exitMe
    If Target.Value > 3 Then
        ActiveSheet.Unprotect
        Range("E10:E40").Locked = False
    End If
exitMe:
    Application.EnableEvents = True

End Sub
should do it. If they aren't, you'd have to incorporate that. Post back if you need some help with that. Hope that helps!
 
Upvote 0
Press Alt-F11 to open the VBE.
Press Control-R to open the Project Explorer.
Click "Microsoft Excel Objects" for the file you're working on.
Double-click the sheet where you need this to work.
Open the Code pane with F7.
Paste the above code in.
Press Alt-Q to close the VBE and return to Excel.

HTH
 
Upvote 0
important questions if you would use code for this
is J4 a formula ?
can the value go down again ?

YES = other code needed
(but I wouldn't use code if it can be easily done without)

kind regards,
Erik
 
Upvote 0
FYI I have been told many times that I shouldnt try to get tech help online. I am rather slow on the uptake.
:) EDMONd
 
Upvote 0

Forum statistics

Threads
1,214,576
Messages
6,120,350
Members
448,956
Latest member
Adamsxl

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