ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Reset button code for Radio Buttons (https://www.excelbanter.com/excel-discussion-misc-queries/176552-reset-button-code-radio-buttons.html)

[email protected]

Reset button code for Radio Buttons
 
I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.

WLMPilot

Reset button code for Radio Buttons
 
You should be able to place the radio buttons within a "frame" (see control
box) and only be able to choose one radio button.

Les

" wrote:

I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.


Jim Rech[_2_]

Reset button code for Radio Buttons
 
Maybe a "None" option button.

--
Jim
wrote in message
...
| I've created a form and I'm using Radio Buttons with an Option Box to
| prevent the user from selecting multiple items. The problem is that
| if by accident they choose one of the items within the option box and
| don't really want that there is no way to clear the radio button. I'd
| like to place a "reset" button in the form but don't know the code to
| pub behind the button to clear all the radio buttons. Can someone
| help me out please.....thanks in advance.



Mike Rogers[_2_]

Reset button code for Radio Buttons
 
dworst

Place this in the worksheet module and attach it to your clear buttom or
keyboard short cut.

Sub testme()

Dim OptBTN As OptionButton
Dim OLEObj As OLEObject

For Each OptBTN In ActiveSheet.OptionButtons
OptBTN.Value = xlOff
Next OptBTN

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is msforms.OptionButton Then
OLEObj.Object.Value = False
End If
Next OLEObj

End Sub


Mike Rogers


" wrote:

I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.


Dave Peterson

Reset button code for Radio Buttons
 
I'm not sure what you're doing, but it might make it easier for the user to add
another optionbutton within that frame that represents "none of these".



wrote:

I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.


--

Dave Peterson

Tiffany

Reset button code for Radio Buttons
 
Does this code work for buttons within Microsoft Frames?
--
TASR


"Mike Rogers" wrote:

dworst

Place this in the worksheet module and attach it to your clear buttom or
keyboard short cut.

Sub testme()

Dim OptBTN As OptionButton
Dim OLEObj As OLEObject

For Each OptBTN In ActiveSheet.OptionButtons
OptBTN.Value = xlOff
Next OptBTN

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is msforms.OptionButton Then
OLEObj.Object.Value = False
End If
Next OLEObj

End Sub


Mike Rogers


" wrote:

I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.


[email protected]

Reset button code for Radio Buttons
 
thanks alot..it worked for me :)






On Wednesday, February 13, 2008 9:09:02 PM UTC+5:30, Mike Rogers wrote:
dworst

Place this in the worksheet module and attach it to your clear buttom or
keyboard short cut.

Sub testme()

Dim OptBTN As OptionButton
Dim OLEObj As OLEObject

For Each OptBTN In ActiveSheet.OptionButtons
OptBTN.Value = xlOff
Next OptBTN

For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is msforms.OptionButton Then
OLEObj.Object.Value = False
End If
Next OLEObj

End Sub


Mike Rogers


" wrote:

I've created a form and I'm using Radio Buttons with an Option Box to
prevent the user from selecting multiple items. The problem is that
if by accident they choose one of the items within the option box and
don't really want that there is no way to clear the radio button. I'd
like to place a "reset" button in the form but don't know the code to
pub behind the button to clear all the radio buttons. Can someone
help me out please.....thanks in advance.




All times are GMT +1. The time now is 09:51 PM.

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