I have a workbook with a number of sheets, two of which are "Details" and "Details (cont)". Based on the inputs in sheet "Details" I would like the second sheet to be visible or hidden.
More specifically, I have created a Group box (from the Forms toolbar) within sheet "Details" and inserted 3 Option boxes ("Yes", "No", and "Not applicable"). These option boxes are linked to cell G1, and return 1, 2 or 3 respectively. I would like second sheet, "Details (cont)", to be hidden if cell G1 within sheet "Details" = 3, i.e. if the user selected "Not applicable". I have done some research and I came up with the following code which I placed in the sheet "Details":
The problem with the above is that the second sheet is only toggled between hidden and unhidden if I manually edit cell G1 to read "3". Changing cell G1 indirectly via the Option buttons has no effect on whether the sheet "Details (cont)" is hidden or not.
Any help on how I can resolve this would be greatly appreciated.
More specifically, I have created a Group box (from the Forms toolbar) within sheet "Details" and inserted 3 Option boxes ("Yes", "No", and "Not applicable"). These option boxes are linked to cell G1, and return 1, 2 or 3 respectively. I would like second sheet, "Details (cont)", to be hidden if cell G1 within sheet "Details" = 3, i.e. if the user selected "Not applicable". I have done some research and I came up with the following code which I placed in the sheet "Details":
Code:
Private Sub worksheet_change(ByVal target As Excel.Range)
Select Case Worksheets("Details").Range("G1").Value
Case 3
Worksheets("Details (cont)").Visible = False
Case Is <> 3
Worksheets("Details (cont)").Visible = True
End Select
End Sub
The problem with the above is that the second sheet is only toggled between hidden and unhidden if I manually edit cell G1 to read "3". Changing cell G1 indirectly via the Option buttons has no effect on whether the sheet "Details (cont)" is hidden or not.
Any help on how I can resolve this would be greatly appreciated.
Last edited: