ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unselect OptionButton. How to? (https://www.excelbanter.com/excel-programming/343515-unselect-optionbutton-how.html)

Matt[_33_]

Unselect OptionButton. How to?
 
Folks,

I have a macro with a data input screen.

Amongst others there are 5 optionbuttons. The macor must not continue
without one checked.

I do that by each subroutine of each option button writes the value 1
in a cell.

If there is no value 1 in that cell the macro will clear all selections
restart.

The problem is that now it cleared the 1 and it thinks no button is
selected, but really the button is STILL selected.

Is there a way to uncheck these buttons from inside the macro? OR at
least reset them all to default, like when the macro starts the first
time?

Thanks!
Matt


Leith Ross[_86_]

Unselect OptionButton. How to?
 

Hello Matt,

Since you don't say if the buttons are on a worksheet or a user form,
am giving methods for either type of button.

FORMS TOOLBAR OPTION BUTTO

Sub ClearOptionButton()

Shapes("Option Button 1").ControlFormat.Value = False

End Sub

To set the button, change False to True.


CONTROL TOOLBOX (VBA

Sub ClearOptionButton()

OptionButton1.Value = False

End Sub

The Option Button Control name is in Red. Change this to match the nam
of the control to be reset.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47841


Matt[_33_]

Unselect OptionButton. How to?
 
Its on a user form. Thanks for your help! :)

Will be able to try it on monday...

Matt


Matt[_33_]

Unselect OptionButton. How to?
 
Works like a charm :)

Even better I am now (trying) to use Rowsource to select the range for
the drop down menu based on the amount of cells I have (varies all the
time).

Now the problem is that if I select rowsource before I open the form it
gives an error and otherwiese the dropdown menu wont adjust its size
until after the user clicks somehting..

How can I use the rowsource for a combox command before the form is
visible?

Matt


Leith Ross[_100_]

Unselect OptionButton. How to?
 

Hello Matt,

Generally when you link a editing object (Textbox, ComboBox) to a cell
it is pass the information from the control to the worksheet cell. You
are doing the reverse. You can more than likely use another method to
load the ComboBox based on the cells. Can you post or emial your
workbook so I can see what you are doing? I will faster than doing
multiple posts trying to explain.

Thanks,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=478412


Matt[_33_]

Unselect OptionButton. How to?
 
Hi Leith,

thanks for your offer to help! I was able to solve the problem by
useing a suggestion posted by some of the other guys. But I am still
having problems with weird textbox behaviour...

I cant seem to retrieve your email address though :(

Matt


Leith Ross[_110_]

Unselect OptionButton. How to?
 

Hello Matt,

My email is .

Sincerely,
Leith Ros

--
Leith Ros

-----------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47841



All times are GMT +1. The time now is 12:22 AM.

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