ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   radio button text bold when clicked (https://www.excelbanter.com/excel-programming/432414-radio-button-text-bold-when-clicked.html)

dgold82

radio button text bold when clicked
 
Is there a way to make the text of a radio button (option button from forms)
bold when clicked? Thanks.

joel

radio button text bold when clicked
 

Private Sub OptionButton1_Click()
Set but = ActiveSheet.OptionButton1
but.Font.Bold = True
End Sub

"dgold82" wrote:

Is there a way to make the text of a radio button (option button from forms)
bold when clicked? Thanks.


dgold82

radio button text bold when clicked
 
Thanks for the reply but unfortunately I am getting an error saying variable
not defined and highlighting "but ="

I am running excel 2007 and placed your code in the worksheet module. I also
placed it in a regular module but got the same error.

Also, I want to make it so that any option button on the page turns its text
bold when clicked/filled not specific to to just one option button. I have
over 200 option buttons on each worksheet...

Thanks!

"Joel" wrote:


Private Sub OptionButton1_Click()
Set but = ActiveSheet.OptionButton1
but.Font.Bold = True
End Sub

"dgold82" wrote:

Is there a way to make the text of a radio button (option button from forms)
bold when clicked? Thanks.


Rick Rothstein

radio button text bold when clicked
 
That is because 'but' is not declared as some type of object. However, I
don't think the 'but' variable would even be needed. This is untested, but
try...

Private Sub OptionButton1_Click()
ActiveSheet.OptionButton1.Font.Bold = True
End Sub

--
Rick (MVP - Excel)


"dgold82" wrote in message
...
Thanks for the reply but unfortunately I am getting an error saying
variable
not defined and highlighting "but ="

I am running excel 2007 and placed your code in the worksheet module. I
also
placed it in a regular module but got the same error.

Also, I want to make it so that any option button on the page turns its
text
bold when clicked/filled not specific to to just one option button. I have
over 200 option buttons on each worksheet...

Thanks!

"Joel" wrote:


Private Sub OptionButton1_Click()
Set but = ActiveSheet.OptionButton1
but.Font.Bold = True
End Sub

"dgold82" wrote:

Is there a way to make the text of a radio button (option button from
forms)
bold when clicked? Thanks.



dgold82

radio button text bold when clicked
 
Got a runtime error...

"Rick Rothstein" wrote:

That is because 'but' is not declared as some type of object. However, I
don't think the 'but' variable would even be needed. This is untested, but
try...

Private Sub OptionButton1_Click()
ActiveSheet.OptionButton1.Font.Bold = True
End Sub

--
Rick (MVP - Excel)


"dgold82" wrote in message
...
Thanks for the reply but unfortunately I am getting an error saying
variable
not defined and highlighting "but ="

I am running excel 2007 and placed your code in the worksheet module. I
also
placed it in a regular module but got the same error.

Also, I want to make it so that any option button on the page turns its
text
bold when clicked/filled not specific to to just one option button. I have
over 200 option buttons on each worksheet...

Thanks!

"Joel" wrote:


Private Sub OptionButton1_Click()
Set but = ActiveSheet.OptionButton1
but.Font.Bold = True
End Sub

"dgold82" wrote:

Is there a way to make the text of a radio button (option button from
forms)
bold when clicked? Thanks.




Rick Rothstein

radio button text bold when clicked
 
I just re-read your original message and see you used an OptionButton from
the Form's toolbar... I'm pretty sure you can't change the font properties
on that type of control. Now, if you use an ActiveX OptionButton from the
Control Toolbox toolbar instead, then you can use this event code (it goes
on the worksheet's code window, *not* in a general Module) to make the font
bold whenever the OptionButton is selected...

Private Sub OptionButton1_Change()
With Sheet7.OptionButton1
.Font.Bold = .Value
End With
End Sub

Change the Sheet7 reference in my example code to the actual sheet name the
control is on.

--
Rick (MVP - Excel)


"dgold82" wrote in message
...
Got a runtime error...

"Rick Rothstein" wrote:

That is because 'but' is not declared as some type of object. However, I
don't think the 'but' variable would even be needed. This is untested,
but
try...

Private Sub OptionButton1_Click()
ActiveSheet.OptionButton1.Font.Bold = True
End Sub

--
Rick (MVP - Excel)


"dgold82" wrote in message
...
Thanks for the reply but unfortunately I am getting an error saying
variable
not defined and highlighting "but ="

I am running excel 2007 and placed your code in the worksheet module. I
also
placed it in a regular module but got the same error.

Also, I want to make it so that any option button on the page turns its
text
bold when clicked/filled not specific to to just one option button. I
have
over 200 option buttons on each worksheet...

Thanks!

"Joel" wrote:


Private Sub OptionButton1_Click()
Set but = ActiveSheet.OptionButton1
but.Font.Bold = True
End Sub

"dgold82" wrote:

Is there a way to make the text of a radio button (option button
from
forms)
bold when clicked? Thanks.





Gary Keramidas

radio button text bold when clicked
 
you can use the other's suggestions, but if you have more than 1 optionbutton,
you would need to set the font to normal if someone changes their mind or makes
a mistake.

just a thought.
--


Gary Keramidas
Excel 2003


"dgold82" wrote in message
...
Is there a way to make the text of a radio button (option button from forms)
bold when clicked? Thanks.



Rick Rothstein

radio button text bold when clicked
 
The code I posted does that.

--
Rick (MVP - Excel)


"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
you can use the other's suggestions, but if you have more than 1
optionbutton, you would need to set the font to normal if someone changes
their mind or makes a mistake.

just a thought.
--


Gary Keramidas
Excel 2003


"dgold82" wrote in message
...
Is there a way to make the text of a radio button (option button from
forms)
bold when clicked? Thanks.





All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com