#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Radio Button Macro

I have two radio buttons labeled "Yes" and "No" within the same group box. I
need a macro to run that hides rows when the "Yes" radio button is chosen and
that unhides rows when the "No" radio button is chosen. What do I need to do
to make the radio buttons automatically run the macro upon clicking them? I
don't know how to tie the macro to the two Yes/No radio buttons or what
syntax to use in the macro to recognize the radio buttons and the result of
Yes or No to make it run. Here is what I have but I'm missing the proper
syntax for the first line.
If [radio button???] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = True
End If
If [radio button] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = False
End If

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Radio Button Macro

Use these 2 macros instead - then right click on the radio button and "Assign
Macro" to the appropriate one


Sub HideRows()


Rows("35:49").Select
Selection.EntireRow.Hidden = True

End Sub


Sub ShowRows()

Rows("35:49").Select
Selection.EntireRow.Hidden = False

End Sub

"Lisa C." wrote:

I have two radio buttons labeled "Yes" and "No" within the same group box. I
need a macro to run that hides rows when the "Yes" radio button is chosen and
that unhides rows when the "No" radio button is chosen. What do I need to do
to make the radio buttons automatically run the macro upon clicking them? I
don't know how to tie the macro to the two Yes/No radio buttons or what
syntax to use in the macro to recognize the radio buttons and the result of
Yes or No to make it run. Here is what I have but I'm missing the proper
syntax for the first line.
If [radio button???] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = True
End If
If [radio button] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = False
End If


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Radio Button Macro

Wow, that was easy. Thanks!
Is there a way to use a List and run a macro based on the value selected on
the list that hides/unhides worksheets?


"dhstein" wrote:

Use these 2 macros instead - then right click on the radio button and "Assign
Macro" to the appropriate one


Sub HideRows()


Rows("35:49").Select
Selection.EntireRow.Hidden = True

End Sub


Sub ShowRows()

Rows("35:49").Select
Selection.EntireRow.Hidden = False

End Sub

"Lisa C." wrote:

I have two radio buttons labeled "Yes" and "No" within the same group box. I
need a macro to run that hides rows when the "Yes" radio button is chosen and
that unhides rows when the "No" radio button is chosen. What do I need to do
to make the radio buttons automatically run the macro upon clicking them? I
don't know how to tie the macro to the two Yes/No radio buttons or what
syntax to use in the macro to recognize the radio buttons and the result of
Yes or No to make it run. Here is what I have but I'm missing the proper
syntax for the first line.
If [radio button???] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = True
End If
If [radio button] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = False
End If


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Radio Button Macro

I haven't worked with the excel version - but you can create a combo box
which should let you do that. I'll defer to somebody else here that perhaps
can give you more information.

"Lisa C." wrote:

Wow, that was easy. Thanks!
Is there a way to use a List and run a macro based on the value selected on
the list that hides/unhides worksheets?


"dhstein" wrote:

Use these 2 macros instead - then right click on the radio button and "Assign
Macro" to the appropriate one


Sub HideRows()


Rows("35:49").Select
Selection.EntireRow.Hidden = True

End Sub


Sub ShowRows()

Rows("35:49").Select
Selection.EntireRow.Hidden = False

End Sub

"Lisa C." wrote:

I have two radio buttons labeled "Yes" and "No" within the same group box. I
need a macro to run that hides rows when the "Yes" radio button is chosen and
that unhides rows when the "No" radio button is chosen. What do I need to do
to make the radio buttons automatically run the macro upon clicking them? I
don't know how to tie the macro to the two Yes/No radio buttons or what
syntax to use in the macro to recognize the radio buttons and the result of
Yes or No to make it run. Here is what I have but I'm missing the proper
syntax for the first line.
If [radio button???] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = True
End If
If [radio button] = [??] Then
Rows("35:49").Select
Selection.EntireRow.Hidden = False
End If


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
radio button Chey Excel Discussion (Misc queries) 1 January 3rd 08 07:42 PM
radio button help tjb Excel Worksheet Functions 1 September 27th 05 11:51 PM
radio button help tjb Excel Worksheet Functions 1 September 27th 05 01:16 AM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM


All times are GMT +1. The time now is 07:18 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"