Hi All,

I am trying to use a VBA function to hide unused worksheets. The code is as follows:

Private Sub worksheet_change(ByVal target As Excel.Range)
Select Case Worksheets("Door Data Entry").Range("r26").Value
Case "Yes"
Worksheets("LH Door Inking Detail").Visible = True
Worksheets("RH Door Inking Detail").Visible = True
Case "No"
Worksheets("LH Door Inking Detail").Visible = False
Worksheets("RH Door Inking Detail").Visible = False
End Select
End Sub

However, in order for this to work, the cell 'r26' cannot seem to have its contents created by a function in the cell. It only works if I type a value of 'Yes' or 'No' directly into the cell.

I'd like to use a vba function that changes the value of this cell based on that of another cell, e.g.

If cell 'q15' in 'Door Frame' = "No Lock" then worksheets("Door Data Entry").range("r26") = No

Else worksheets("Door Data Entry").range("r26") = Yes

Sorry if I haven't explained very well. Let me know if I need to clarify.

Thanks,

Richard