+ Reply to Thread
Results 1 to 3 of 3

Events For Option Button Embedded in an Activex Microsoft Forms 2.0 Frame Control

Hybrid View

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    2

    Events For Option Button Embedded in an Activex Microsoft Forms 2.0 Frame Control

    Hi everyone,

    I want to show and hide rows by clicking on option buttons embedded in an ActiveX Microsoft Forms 2.0 Frame Control. Please see this screenshot:

    screen01.gif

    This is my first time experimenting with the Visual Basic editor in Excel 2007. What I have pieced-together so far is from various google searches in an attempt to figure things out but it is not working. Here is my code:

    Option Explicit
    
    Private Sub MissionButtons_Click()
    
    End Sub
    
     Private Sub ISS_Click()
    
            ISS.Value = True
            Rows(5).EntireRow.Hidden = False
            Rows(6).EntireRow.Hidden = False
            Rows(8).EntireRow.Hidden = True
            Rows(9).EntireRow.Hidden = True
            Rows(11).EntireRow.Hidden = True
            Rows(12).EntireRow.Hidden = True
    End Sub
    
     Private Sub Moon_Click()
    
            Moon.Value = True
            Rows(5).EntireRow.Hidden = True
            Rows(6).EntireRow.Hidden = True
            Rows(8).EntireRow.Hidden = False
            Rows(9).EntireRow.Hidden = False
            Rows(11).EntireRow.Hidden = True
            Rows(12).EntireRow.Hidden = True
    End Sub
    
     Private Sub Mars_Click()
    
            Mars.Value = True
            Rows(5).EntireRow.Hidden = True
            Rows(6).EntireRow.Hidden = True
            Rows(8).EntireRow.Hidden = True
            Rows(9).EntireRow.Hidden = True
            Rows(11).EntireRow.Hidden = False
            Rows(12).EntireRow.Hidden = False
    End Sub
    My biggest hurdle is that I do not understand properly how to give each option button a command while they are inside a Microsoft Forms 2.0 Frame Control.

    Thank you all very much for your time and help.

    Sincerely,

    Chris

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Events For Option Button Embedded in an Activex Microsoft Forms 2.0 Frame Control

    Your code should work regardless if the option buttons are within a frame control.

    Are the optionbutton names (not caption) exactly ISS, Moon, and Mars?

    Also, you don't need the lines like ISS.Value = True, but that's not causing an issue.

    Private Sub ISS_Click()
        Rows("5:6").Hidden = False
        Rows("8:9").Hidden = True
        Rows("11:12").Hidden = True
    End Sub
    
    Private Sub Moon_Click()
        Rows("5:6").Hidden = True
        Rows("8:9").Hidden = False
        Rows("11:12").Hidden = True
    End Sub
    
    Private Sub Mars_Click()
        Rows("5:6").Hidden = True
        Rows("8:9").Hidden = True
        Rows("11:12").Hidden = False
    End Sub
    Last edited by AlphaFrog; 05-28-2014 at 10:33 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-28-2014
    Posts
    2

    Re: Events For Option Button Embedded in an Activex Microsoft Forms 2.0 Frame Control

    Hi AlphaFrog,

    Thank you very much! It worked. I got rid of the frame control and used your code and now it works like a charm. What's even better is that your code is much more elegant and easier to understand than what I had so thank you for the education.

    All the best to you,

    Chris

+ 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. Activex frame hides option buttons - Xl 2007
    By Richard Buttrey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2018, 01:32 PM
  2. Control Forms or ActiveX Control
    By ASPERO in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2011, 04:57 PM
  3. Excel prints everytime I click a link in embedded microsoft web browser activex
    By philipbc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2010, 07:51 AM
  4. Writing trigger events for controls embedded in forms.frame control
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2009, 08:04 PM
  5. ActiveX Control Events dropped | lost | blocked - Excel / VBA
    By Rick Labs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2005, 11:05 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