Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default option button (yes No) to hide rows

Hello I have two option buttons one says yes the other No
SO if the option selected is yes I want to unhide row A32 thruA44 if No is
selected then rows A32 thru A44 remain hidden
this is what I have but it does not work
Private Sub OptionButton1_Click()
Dim myRng As Range

Set myRng = Me.Range("a32:a44")

myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)

End Sub
thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default option button (yes No) to hide rows

You could simplify it to:

Private Sub OptionButton1_Click()
Range("A32:A44").EntireRow.Hidden = Not (Range("A32:A44").EntireRow.Hidden)
End Sub

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Wanna Learn" wrote:

Hello I have two option buttons one says yes the other No
SO if the option selected is yes I want to unhide row A32 thruA44 if No is
selected then rows A32 thru A44 remain hidden
this is what I have but it does not work
Private Sub OptionButton1_Click()
Dim myRng As Range

Set myRng = Me.Range("a32:a44")

myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)

End Sub
thanks for your help

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default option button (yes No) to hide rows

Thanks Luke
This works fine but If I select the "NO" command button nothing happens . If
No is selected I want the rows a32 to A44 remain hidden. (I cannot deselect
Yes) Thanks again

"Luke M" wrote:

You could simplify it to:

Private Sub OptionButton1_Click()
Range("A32:A44").EntireRow.Hidden = Not (Range("A32:A44").EntireRow.Hidden)
End Sub

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Wanna Learn" wrote:

Hello I have two option buttons one says yes the other No
SO if the option selected is yes I want to unhide row A32 thruA44 if No is
selected then rows A32 thru A44 remain hidden
this is what I have but it does not work
Private Sub OptionButton1_Click()
Dim myRng As Range

Set myRng = Me.Range("a32:a44")

myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)

End Sub
thanks for your help

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default option button (yes No) to hide rows

Assuming your buttons are labeled 1 and 2 respectively:

Private Sub OptionButton1_Click()
'This is the "YES" button
Range("A32:A44").EntireRow.Hidden = True
End sub

Private Sub OptionButton2_Click()
'This is the "NO" button
Range("A32:A44").EntireRow.Hidden = False
End sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Wanna Learn" wrote:

Thanks Luke
This works fine but If I select the "NO" command button nothing happens . If
No is selected I want the rows a32 to A44 remain hidden. (I cannot deselect
Yes) Thanks again

"Luke M" wrote:

You could simplify it to:

Private Sub OptionButton1_Click()
Range("A32:A44").EntireRow.Hidden = Not (Range("A32:A44").EntireRow.Hidden)
End Sub

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Wanna Learn" wrote:

Hello I have two option buttons one says yes the other No
SO if the option selected is yes I want to unhide row A32 thruA44 if No is
selected then rows A32 thru A44 remain hidden
this is what I have but it does not work
Private Sub OptionButton1_Click()
Dim myRng As Range

Set myRng = Me.Range("a32:a44")

myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)

End Sub
thanks for your help

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
Hide option buttons Wanna Learn Excel Discussion (Misc queries) 2 March 6th 08 02:48 PM
hide or unhide rows with button Bea Excel Discussion (Misc queries) 15 September 19th 07 07:03 PM
Code for button to hide/unhide rows Chris Excel Worksheet Functions 5 March 5th 07 06:15 AM
Command Button to Hide/Unhide Rows Bea Excel Discussion (Misc queries) 4 March 16th 06 03:21 PM
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM


All times are GMT +1. The time now is 01:54 PM.

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"