+ Reply to Thread
Results 1 to 8 of 8

Display/Hide radio buttons

Hybrid View

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Question Display/Hide radio buttons

    Hi

    Is it possible to, based on a cell value, display or hide a correspondent radio button?

    I'm using an excel file as a search tool. That search will return values on cells from E5 to E20. It can be 1 result, filling one cell or multiple results, filling the equal amount of cells.
    I've added radio buttons to copy that specific cell value (see code bellow for one of them). What I'm curious about if is it possible to hide the radio button if the correspondent cell is empty. For example, if only 3 results are found, only 3 radio buttons appear (instead of all 15).

    Sub OptionButton2_Click()
    Range("L2").Value = Range("E8").Value
    Range("K3").Select
    Selection.Copy
    End Sub
    Thanks in advance!
    Last edited by 6StringJazzer; 04-07-2015 at 09:59 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,726

    Re: Display/Hide radio buttons

    Here is the idea:

    OptionButton1.Visible = (Range("E5") <> "")
    This would need to be repeated for each button. If your buttons have a regular naming scheme, such as OptionButton1 through OptionButton16 then I think you can do this with a loop but I would have to look up the details.
    Last edited by 6StringJazzer; 03-17-2015 at 10:47 AM. Reason: Streamlined code
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Display/Hide radio buttons

    Hi 6StringJazzer

    Where should I apply this code?

    Quote Originally Posted by 6StringJazzer View Post
    Here is the idea:

    OptionButton1.Visible = (Range("E5") <> "")
    This would need to be repeated for each button. If your buttons have a regular naming scheme, such as OptionButton1 through OptionButton16 then I think you can do this with a loop but I would have to look up the details.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,726

    Re: Display/Hide radio buttons

    Where are the radio buttons? In a worksheet, or in a userform?

  5. #5
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Display/Hide radio buttons

    In a worksheet.

    Quote Originally Posted by 6StringJazzer View Post
    Where are the radio buttons? In a worksheet, or in a userform?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,726

    Re: Display/Hide radio buttons

    At this point it's going to be better if you attach your file. Otherwise I am going to have to create a file and try to imagine what yours looks like, which would take a lot of time.

    To attach a file:
    1. Under the text box where you type your reply click the Go Advanced button.
    2. In the next screen look above the reply box and click the "paper clip" icon. You will get a pop-up screen.
    3. In the pop-up, click Add then Select to select a file from your local drive
    4. Click the Upload button to upload the file
    5. Click Done to attach it.

    It will be displayed as an attachment underneath your post text. Alternatively as the last step you can click the Insert Inline button and a hyperlink to the file will be inserted directly into your post text in the spot where your cursor is set at the moment you click the button.

    Here are step-by-step instructions with screen shots

  7. #7
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Display/Hide radio buttons

    Hi 6StringJazzer! Sorry for the delay!

    Here is the file.
    Reference Guide - New.xlsm
    Besides the dummy data, everything else is real.
    You can search for "1", "2", "3", etc. When searching for "1", for example, only one line is fulfilled and my intention is to hide the radio buttons that correspond to no results.
    So: If B9 is empty OptionButton3 is hidden.

    Does this help?

    Thanks again!

  8. #8
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: Display/Hide radio buttons

    Someone? Please?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 09-17-2013, 10:36 AM
  2. [SOLVED] Using Radio Buttons to display Pictures
    By Chrizzo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 05:48 PM
  3. How do I setup radio buttons to display different worksheet data in graphs
    By Dan Murphy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2010, 12:36 AM
  4. Using VBA to link Radio Buttons to Display an observation
    By isara912 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-16-2008, 09:55 AM
  5. Radio Buttons Selecting Other Radio Buttons
    By Neonate928 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-13-2007, 11:19 PM

Tags for this Thread

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