+ Reply to Thread
Results 1 to 4 of 4

OptionButton

  1. #1
    Registered User
    Join Date
    05-02-2008
    Posts
    2

    OptionButton

    Hi,

    I have placed 2 OptionButtons on an excel worksheet. How do I access the properties of the OptionButtons 2 determine if they have been selected or not. I don't want to use the cell link option, rather, I want to do something more object orientated like:-
    if Controls("OptionButton1").Value > 0 then
    ...
    end if

    Many Thanks,
    Dion.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning diono

    ...and welcome to the forum!!

    From what you say, it sounds like you are using option buttons off the forms toolbar. If you want more control you would be well advised to use the option buttons from the Control Toolbox toolbar which offer you a finer degree of control over the issue, but in return are more difficult to work with. Once set up double clicking the control will open the associated module window which allows you to enter event procedure code defining what is to happen when a user interacts with the buttons.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    05-02-2008
    Posts
    2

    OptionButtons

    Thanks DominicB,

    So I cannot access a 'OptionButton.Checked' field value using the control from the Forms pallete. Will I be able to do so if I use the other?

    Thanks,
    Dion.

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi

    You can assign a macro when it is clicked, so you could set up a macro attached to one option button that does one thing, and a different macro to do something else when the other button is selected. However, you can only capture the value of the option button to a worksheet cell.

    Using objects from the Control Toolbox form gives you a much wider scope for control, enabling you to run macros when they are selected, and load the value of the option buttons as a variable. There are also dozens of properties for you to play with controlling how the control both looks and reacts with users.

    HTH

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1