I have some code that hides and unhides a worksheet in excel. The table below is an example of my data. I have yes and no option buttons that open and close other worksheets depending on the answer. Yes would open a worksheet and no would close it.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Geotechnical[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]Investigations[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]shallow foundations[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]roads[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
</tbody>[/TABLE]
The code I have so far is quite simple and just hides and unhides the worksheets(see below)
My problem is that if I click no for investigations I still want the worksheet to stay open if for example roads is selected as yes.
Is there code that can help me?
I am fairly new to VBA any help will be greatly appreciated, also I hope my post makes sense.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Geotechnical[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]Investigations[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]shallow foundations[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
[TR]
[TD]roads[/TD]
[TD]yes[/TD]
[TD]no[/TD]
[/TR]
</tbody>[/TABLE]
The code I have so far is quite simple and just hides and unhides the worksheets(see below)
Code:
Private Sub no2_investigations_Click()
Worksheets(1).Visible = True
Worksheets(2).Visible = True
Worksheets(3).Visible = False
End Sub
My problem is that if I click no for investigations I still want the worksheet to stay open if for example roads is selected as yes.
Is there code that can help me?
I am fairly new to VBA any help will be greatly appreciated, also I hope my post makes sense.