+ Reply to Thread
Results 1 to 11 of 11

VBA User Form - Option Button

Hybrid View

  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    VBA User Form - Option Button

    Dear Friends,

    I need some help regarding the option buttons created in VBA Userforms.

    You can find the Spreadsheet attached here for reference regarding the issue.

    I have created a form "frmSelection" and it pops up when the "Check Section" command button is clicked. After displaying the form, I tried to keep option button "IS800-1984" default enabled.

    If user changes the "Code Selection", for example "IS 800-2007" then another form will be displayed, i.e., frmIS8002007.

    When this form is opened, I want to keep "Simply Supported", "Restrained" and "Hot Rolled Sections" enabled by default.

    I even wrote the corresponding code but I am unable to get these controls enabled by default.

    Kindly refer to the attached sheet and suggest me.

    Thanks in advance
    Srinivas
    Attached Files Attached Files
    Last edited by nivassrii; 05-26-2011 at 06:33 AM.

  2. #2
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: VBA User Form - Option Button

    add the following code to the frmSelection form:
    Private Sub UserForm_Activate()
    Me.optIS8001984.Value = True
    End Sub
    and this code to frmIS8002007 form
    Private Sub UserForm_Activate()
    Me.optSS.Value = True
    Me.optRestrained.Value = True
    Me.optStandard.Value = True
    End Sub

  3. #3
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA User Form - Option Button

    Do I need replace UserForm with my Form name.

  4. #4
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: VBA User Form - Option Button

    no you don't just insert them as they are

  5. #5
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA User Form - Option Button

    Then, where do i need to insert them?. I am a bit confused where to insert this. Please misunderstand.

  6. #6
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: VBA User Form - Option Button

    the first one in the frmSelection code module,, right click on the form and select view code then copy and paste the above code.
    the second one in the frmIS8002007 code module,, do the same as above

  7. #7
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA User Form - Option Button

    Thank you,

    It's done. I ve one more doubt. How can I interlink between two different forms. I mean to say getting data from one form through user entries and trasferring the same to other form in order to use them for rest of the calculations.

    Also, is there a way to link between "Cancel" button in my form to the form Close button
    Last edited by nivassrii; 05-26-2011 at 04:53 AM.

  8. #8
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA User Form - Option Button

    After selecting few options in "frmSelection" and if once the Cancel button is pressed and opted "No" in order to come to the previous window, earlier selections have been erased. How to avoid this.

    Can somebody suggest me.

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: VBA User Form - Option Button

    Hi nivassrii,
    If your question is solved please change the prefix to “solved”. If you have another question start a new thread. This is to ensure the thread title and question is relevant, helping those searching for a similar requirement.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  10. #10
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: VBA User Form - Option Button

    Quote Originally Posted by pike View Post
    Hi nivassrii,
    If your question is solved please change the prefix to “solved”. If you have another question start a new thread. This is to ensure the thread title and question is relevant, helping those searching for a similar requirement.
    Thank you. Sure I do. But how can I set [Solved]

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: VBA User Form - Option Button

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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