Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Having a macro recognize when an option button has been selected

Hi,

I'm trying to an IF THEN statement which is based on which one of two option
buttons was last selected. I have two option buttons ("OptionButton1" and
"OptionButton2" -- both from the 'Forms' menu) -- basically I'm trying to
create a macro that will look at which button is currently selected (this
button will already have it's radio button showing as being selected) and
will then execute code specific to which button it finds as being last
selected. Basically, I want the following:

'If 'OptionButton1' is slected, then:

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Equivalent kwh/yr"

Else

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Actual kwh/yr"

End If


Thanks for your help!

Rob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Having a macro recognize when an option button has been selected

You may need to edit the option button name but something like:

With Sheets("2nd Level Sources & Conv")
If .OptionButtons("Option Button 1") = 1 Then
.Range("F27").Value = "Equivalent kwh/yr"
Else
.Range("F27").Value = "Actual kwh/yr"
End If
End With

Hope this helps
Rowan

"Linking to specific cells in pivot table" wrote:

Hi,

I'm trying to an IF THEN statement which is based on which one of two option
buttons was last selected. I have two option buttons ("OptionButton1" and
"OptionButton2" -- both from the 'Forms' menu) -- basically I'm trying to
create a macro that will look at which button is currently selected (this
button will already have it's radio button showing as being selected) and
will then execute code specific to which button it finds as being last
selected. Basically, I want the following:

'If 'OptionButton1' is slected, then:

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Equivalent kwh/yr"

Else

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Actual kwh/yr"

End If


Thanks for your help!

Rob

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Having a macro recognize when an option button has been select

Thanks!!

"Rowan" wrote:

You may need to edit the option button name but something like:

With Sheets("2nd Level Sources & Conv")
If .OptionButtons("Option Button 1") = 1 Then
.Range("F27").Value = "Equivalent kwh/yr"
Else
.Range("F27").Value = "Actual kwh/yr"
End If
End With

Hope this helps
Rowan

"Linking to specific cells in pivot table" wrote:

Hi,

I'm trying to an IF THEN statement which is based on which one of two option
buttons was last selected. I have two option buttons ("OptionButton1" and
"OptionButton2" -- both from the 'Forms' menu) -- basically I'm trying to
create a macro that will look at which button is currently selected (this
button will already have it's radio button showing as being selected) and
will then execute code specific to which button it finds as being last
selected. Basically, I want the following:

'If 'OptionButton1' is slected, then:

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Equivalent kwh/yr"

Else

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Actual kwh/yr"

End If


Thanks for your help!

Rob

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Having a macro recognize when an option button has been selected

absolutely unrelated ... but I think you can change your screen name through
Outlook Express (if that is your reader) by going to Tools--Accounts--
click on MSNews.Microsoft.com and then click Properties and under User
Information, change the Name there.

Good Luck.

Bill.

...."We now return you to your regularly scheduled Message Thread"...


"Linking to specific cells in pivot table"
crosoft.com wrote in
message ...
Hi,

I'm trying to an IF THEN statement which is based on which one of two
option
buttons was last selected. I have two option buttons ("OptionButton1" and
"OptionButton2" -- both from the 'Forms' menu) -- basically I'm trying to
create a macro that will look at which button is currently selected (this
button will already have it's radio button showing as being selected) and
will then execute code specific to which button it finds as being last
selected. Basically, I want the following:

'If 'OptionButton1' is slected, then:

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Equivalent
kwh/yr"

Else

Sheets("2nd Level Sources & Conv").Range("F27").Value = "Actual kwh/yr"

End If


Thanks for your help!

Rob



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
macro for button option peyman Excel Discussion (Misc queries) 9 September 14th 07 07:48 PM
Option Button - multiple selected alanap Excel Worksheet Functions 1 April 17th 06 11:04 PM
macro so no option button chosen Ken Ivins[_2_] Excel Programming 0 September 17th 04 08:51 PM
macro so no option button chosen Ken Ivins[_2_] Excel Programming 0 September 17th 04 08:18 PM
Macro to run in same row as selected button nejl Excel Programming 2 September 6th 04 02:17 PM


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

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

About Us

"It's about Microsoft Excel"