+ Reply to Thread
Results 1 to 3 of 3

Show/hide button by condition

Hybrid View

  1. #1
    Registered User
    Join Date
    06-09-2014
    Posts
    4

    Exclamation Show/hide button by condition

    Hi there,
    I have two button for two radio button in the following pics I attached. i want button 2 will be hide when option 1 is selected and button 1 will be hide when option two is selected.

    Is there any VBA code that i can assign it to "Option Button" ?
    Any help will be appreciated.
    Thanks in Advance.
    Attached Images Attached Images
    Last edited by mscofield; 06-15-2014 at 02:56 AM. Reason: Sorry i forgot to attach the pic

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Show/hide button by condition

    Make two option buttons and two command buttons from the forms menu.
    Assign this macro to each of the option buttons.
    Sub AnyOptionButton_Click()
        Dim bossNames As Variant, servantNames As Variant
        Dim i As Long
        
        bossNames = Array("Option Button 1", "Option Button 2"): Rem adjust
        servantNames = Array("Button 3", "Button 4"): Rem adjust
        
        With ActiveSheet
            For i = LBound(bossNames) To UBound(bossNames)
                .Shapes(servantNames(i)).Visible = (.Shapes(bossNames(i)).ControlFormat.Value = xlOn)
            Next i
        End With
    End Sub
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    06-09-2014
    Posts
    4

    Re: Show/hide button by condition

    Thanks mikerickson. Its really works.. This what i just want..

+ 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. Show/Hide a sepcific column based on a condition in a cell
    By uakhan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2013, 05:50 AM
  2. Hide or show Rows with IF condition
    By geekaysys in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-24-2013, 10:05 AM
  3. VBA hide row based on pull down with button to toggle show/hide
    By myronr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 06:07 PM
  4. hide/show range of cells by condition
    By eugz in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-28-2009, 11:10 AM
  5. [SOLVED] How do I hide a command button based on a condition?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2006, 09:50 AM

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