Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default To be able to show only certain sections of worksheet

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default To be able to show only certain sections of worksheet

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Sections RJ Excel Discussion (Misc queries) 0 June 7th 07 05:28 PM
Worksheet Sections RJ Excel Discussion (Misc queries) 2 June 7th 07 04:17 PM
PASSWORD PROTECTING SECTIONS OF A WORKSHEET Todd Excel Discussion (Misc queries) 3 August 1st 06 11:03 PM
Freeze Sections and column in a worksheet Jelinek Excel Discussion (Misc queries) 3 March 28th 06 12:50 PM
How to show/hide sections of a userform? madbloke[_17_] Excel Programming 2 October 6th 04 03:53 PM


All times are GMT +1. The time now is 08:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"