View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Value of one cell unlocks another

Assuming WS_RANGE cells are unlocked and all other cells are locked prior to
protecting the sheet.

If "Yes" is chosen in D3 then D5 is unlocked and selected. Edit to suit.

If not "Yes" then D3 remains selected............edit to suit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Const WS_RANGE As String = "D3,D7,D11,D15,D19,D23,D27"
On Error GoTo enditall
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.Unprotect Password:="justme"
With Target
If .Value < "Yes" Then
.Select 'remove if not wanted
Else
With .Offset(2, 0)
.Locked = False
.Select 'remove if not wanted
End With
End If
End With
End If

enditall:
Application.EnableEvents = True

Me.Protect Password:="justme"

End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the above into that module. Alt + q to return to the Excel
window.



Gord Dibben MS Excel MVP

On Wed, 17 Jun 2009 05:43:02 -0700, Tel
wrote:

Hi Guys,

I am creating a spreadsheet which is, essentially, a questionnaire.

I have a cell (D3) with a pick list in it (Yes/No and a blank to avoid false
entries). If the user selects "Yes" in this cell I need this to trigger
unlocking another cell (D5).

I need to be able to repeat this several times over throughout the
spreadsheet and the workbook (i.e. "Yes" in cell D7 will unlock D9 and the
same for D11 and D13 and so on).

Any help you can offer would be greatly appreciated.

I have alot more functionality I wish to add but I'll come back to that
later.

Thanks All

Tel