Results 1 to 3 of 3
  1. #1
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    set radio button value (Excel 2003)

    I have two radio buttons on a sheet from the Control toolbox. They're named btnCustomer and btnDefault. I want to programmatically set the value to true/false based on other conditions. I have btnDefault's LinkedCell attribute set to a named cell called "UseDefault" and so I can easily change it on/off but that doesn't affect the other radio button (setting UseDefault = fasle doesn't make the other radio button, btnCustomer true). They are both in the same group.

    For the life of me, I can't find the right part of the object model to access that other radio button. I thought it was in Shapes but it's not working (and Shapes doesn't have a 'value' method). Controls collection seemed promising but that doesn't work either.

    <pre>activesheet.shapes("btnCustomer").value = true ' both these fail
    activesehet.controls("btnCustomer").value = true</pre>

    How do I change this button's state?

    Deb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: set radio button value (Excel 2003)

    You can use

    ActiveSheet.btnCustomer = True

    If the code is in the worksheet module, you can use

    Me.btnCustomer = True

    If you use option buttons from the Forms toolbar, both will have the same linked cell. The value of the linked cell is the index of the selected button, i.e. if the first option button is "on". the linked cell has value 1, and if the second option button is "on", the linked cell has value 2. Conversely, setting the linked cell to 1 or 2 will select the appropriate button.

  3. #3
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: set radio button value (Excel 2003)

    Oh MAN!!! That was too easy! Here I was trying to find which object it sat it and the page itself was its parent. <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

    Thank you,
    Deb <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

Posting Permissions

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