PC Review


Reply
Thread Tools Rate Thread

To be able to show only certain sections of worksheet

 
 
Sean
Guest
Posts: n/a
 
      22nd Jul 2009
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
 
Reply With Quote
 
 
 
 
Squeaky
Guest
Posts: n/a
 
      22nd Jul 2009
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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Sections =?Utf-8?B?Uko=?= Microsoft Excel Misc 0 7th Jun 2007 05:28 PM
Worksheet Sections =?Utf-8?B?Uko=?= Microsoft Excel Misc 2 7th Jun 2007 05:13 PM
making slide show, do in sections then past each into final show? =?Utf-8?B?TGFycnlJTm1pY2g=?= Windows XP MovieMaker 5 21st Nov 2005 06:16 PM
Why split a worksheet into sections laxguy1314 Microsoft Excel Misc 3 10th Jul 2004 06:09 AM
e-mailing sections of a worksheet Patti Brodeur Microsoft Excel Misc 0 11th Sep 2003 03:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:35 PM.