Disable a range of Cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I disable a range of cells only for them to become active depending
on the value of another specific cell? I don't want the cells to accept any
input data unless it meets the criteria specified on another cell. For
instance, on the 29th day of February.

Many thanks.
 
Hi SU

This example unlock the cells A5:C10 if cell A1 = "ron"
(Unlock cell A1 also before you try it)

It unprotect/protect the sheet without a password this example but you can add a password if you want


'Place the code in the Sheet module
'
'Right click on a sheet tab and choose view code
'Paste the code there
'Alt-Q to go back to Excel


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If Target.Value = "ron" Then
Me.Unprotect
Range("A5:C10").Locked = False
Me.Protect
Else
Me.Unprotect
Range("A5:C10").Locked = True
Me.Protect
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top