Hi Sean,
This uses a 'forms' button. You can click to fold, then click to unfold.
Copy it to each worksheet module then modify it for the specific worksheet.
For each button on each page, assign the macro for that worksheet.
I created a FORMS button and placed it over cell G2. You can modify what you
need to fit your needs.
Sub button1()
'
' button1 Macro
'
Dim Rng As Range
Set Rng = ActiveSheet.Range("g2") '<<=== CHANGE
If Not Rng Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
If Rng.Value = True Then
Rows("8:10").Hidden = False '<<=== CHANGE
Rows("14:15").Hidden = True '<<=== CHANGE
Range("g2").Select '<<=== CHANGE
ActiveCell.FormulaR1C1 = "False"
GoTo 3
Else: GoTo 2
2
If Range("g2") = False Then '<<=== CHANGE
Rows("4:10").Hidden = True '<<=== CHANGE
Rows("11:15").Hidden = False '<<=== CHANGE
Range("g2").Select '<<=== CHANGE
ActiveCell.FormulaR1C1 = "True"
3
End If
End If
End If
XIT:
Application.EnableEvents = True
End Sub
Let me know if you have problems.
Squeaky
"Sean" wrote:
> I want to be able to show more or less of the screen by clicking a radio
> button.
>
> I have a VB script as below (par of it shown only)
>
> I have 13 x =EMBED("Forms.OptionButton.1","") numbered 1 - 13 They
> are called OptionButton_1 - 13
>
> By clicking on the corresponding radio button - I want it to show as much
> of the worksheet that is necessary. hiding the parts that are not wanted
>
> The worksheet contains almost exactly the same going downward 13 times for
> producing a site survey, for different size sites
>
> I have worked out the rows that will need to be displayed.
>
> I have seen it working before but can't work out how it was done.
>
> ** Happy to email file if it helps**
>
> If Me.OptionButton_5.Value = -1 Then
> Rows("36:175").Hidden = False
> Rows("176:452").Hidden = True
> End If
>
> End Sub
>
> Private Sub OptionButton_6_Click()
>
> If Me.OptionButton_6.Value = -1 Then
> Rows("36:210").Hidden = False
> Rows("211:452").Hidden = True
> End If
>
> End Sub
>
> Private Sub OptionButton_7_Click()
>
> If Me.OptionButton_7.Value = -1 Then
> Rows("36:245").Hidden = False
> Rows("246:452").Hidden = True
> End If
>
> End Sub
|