Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

I have 2 option button. How do I get the state of the option button? (The
optionbutton is not on the userform)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the option

button? (The
optionbutton is not on the userform)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

I'm using forms toolbar. Does the "optionsbutton(1)" refer to the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the option

button? (The
optionbutton is not on the userform)






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

The "optionbuttons(1)" refers to the first (earliest created)
option button on the sheet. Alternatively, you can use the name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)" refer to

the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print

ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the

option
button? (The
optionbutton is not on the userform)








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

Do I put the code within the sub function itself? E.g the groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest created)
option button on the sheet. Alternatively, you can use the name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)" refer to

the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print

ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the

option
button? (The
optionbutton is not on the userform)












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g the

groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest created)
option button on the sheet. Alternatively, you can use the

name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)" refer

to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print

ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the

option
button? (The
optionbutton is not on the userform)












  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g the

groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest created)
option button on the sheet. Alternatively, you can use the

name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)" refer

to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code like

Debug.Print
ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of the
option
button? (The
optionbutton is not on the userform)














  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g the

groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest

created)
option button on the sheet. Alternatively, you can use

the
name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)"

refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code

like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code

like

Debug.Print
ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of

the
option
button? (The
optionbutton is not on the userform)
















  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

is there a way to trace which optionbutton is insert 1st?
"Chip Pearson" wrote in message
...
Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g the
groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest

created)
option button on the sheet. Alternatively, you can use

the
name
of the option button. E.g.,

Debug.Print ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the "optionsbutton(1)"

refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code

like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use code

like

Debug.Print
ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I have 2 option button. How do I get the state of

the
option
button? (The
optionbutton is not on the userform)


















  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

Your best bet is to give specific names to your option buttons
rather than rely on index numbers.


"crapit" wrote in message
...
is there a way to trace which optionbutton is insert 1st?
"Chip Pearson" wrote in message
...
Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g

the
groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest

created)
option button on the sheet. Alternatively, you can

use
the
name
of the option button. E.g.,

Debug.Print

ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the

"optionsbutton(1)"
refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code

like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use

code
like

Debug.Print
ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in

message
...
I have 2 option button. How do I get the state

of
the
option
button? (The
optionbutton is not on the userform)






















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

I get this error "Unable to get OptionButtons property of the worksheet
class"
"Chip Pearson" wrote in message
...
Your best bet is to give specific names to your option buttons
rather than rely on index numbers.


"crapit" wrote in message
...
is there a way to trace which optionbutton is insert 1st?
"Chip Pearson" wrote in message
...
Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself? E.g

the
groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first (earliest
created)
option button on the sheet. Alternatively, you can

use
the
name
of the option button. E.g.,

Debug.Print

ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in message
...
I'm using forms toolbar. Does the

"optionsbutton(1)"
refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in message
...
If the button is from the Forms toolbar, use code
like

Debug.Print ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar, use

code
like

Debug.Print
ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in

message
...
I have 2 option button. How do I get the state

of
the
option
button? (The
optionbutton is not on the userform)






















  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default state of option button

You'll get this error if you attempt to use a name that doesn't
exist. Be sure you are using the correct name of the option
button.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I get this error "Unable to get OptionButtons property of the

worksheet
class"
"Chip Pearson" wrote in message
...
Your best bet is to give specific names to your option

buttons
rather than rely on index numbers.


"crapit" wrote in message
...
is there a way to trace which optionbutton is insert 1st?
"Chip Pearson" wrote in message
...
Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself?

E.g
the
groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first

(earliest
created)
option button on the sheet. Alternatively, you

can
use
the
name
of the option button. E.g.,

Debug.Print

ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in

message
...
I'm using forms toolbar. Does the

"optionsbutton(1)"
refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in

message
...
If the button is from the Forms toolbar, use

code
like

Debug.Print

ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar,

use
code
like

Debug.Print

ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in

message
...
I have 2 option button. How do I get the

state
of
the
option
button? (The
optionbutton is not on the userform)
























  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default state of option button

I still got the error!
The following are the codes:
Sub Group1119_Click()
x = ActiveSheet.OptionButtons("optionbutton1").Value

If x = 1 Then
Range("e1").Select
ActiveCell.Value = "Remove"
Else
Range("e1").Select
ActiveCell.Value = "Insert"
End If

End Sub

"Chip Pearson" wrote in message
...
You'll get this error if you attempt to use a name that doesn't
exist. Be sure you are using the correct name of the option
button.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in message
...
I get this error "Unable to get OptionButtons property of the

worksheet
class"
"Chip Pearson" wrote in message
...
Your best bet is to give specific names to your option

buttons
rather than rely on index numbers.


"crapit" wrote in message
...
is there a way to trace which optionbutton is insert 1st?
"Chip Pearson" wrote in message
...
Do something like

Dim V as Long
V = ActiveSheet.OptionButtons(1).Value
If V = 1 Then
' button is true
Else
' button is false
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"crapit" wrote in message
...
but how do i get it to store to a variable?
"Chip Pearson" wrote in message
...
Yes, put the code in the sub itself.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"crapit" wrote in message
...
Do I put the code within the sub function itself?

E.g
the
groupname of the
2 optionbutton is "Group19"
Sub group19_click()
<Should the code be put here?
End sub

"Chip Pearson" wrote in message
...
The "optionbuttons(1)" refers to the first

(earliest
created)
option button on the sheet. Alternatively, you

can
use
the
name
of the option button. E.g.,

Debug.Print
ActiveSheet.OptionButtons("TheButton").Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"crapit" wrote in

message
...
I'm using forms toolbar. Does the
"optionsbutton(1)"
refer
to
the name of
the optionbutton or something else?
"Chip Pearson" wrote in

message
...
If the button is from the Forms toolbar, use

code
like

Debug.Print

ActiveSheet.OptionButtons(1).Value

If the button is from the Controls toolbar,

use
code
like

Debug.Print

ActiveSheet.OLEObjects("OptionButton1").Object.Val ue


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"crapit" wrote in
message
...
I have 2 option button. How do I get the

state
of
the
option
button? (The
optionbutton is not on the userform)


























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
replace state names with state code abbreviations se7098 Excel Worksheet Functions 3 July 25th 09 06:41 PM
How can I show state-by-state data (as silos) on a map of NA Rob Charts and Charting in Excel 0 November 5th 07 03:41 PM
Converting State Names to State Abbreviations aznate Excel Discussion (Misc queries) 1 October 20th 06 06:52 AM
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
Option Button Help justaguyfromky Excel Worksheet Functions 2 September 5th 05 10:28 PM


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