+ Reply to Thread
Results 1 to 8 of 8

User Form with option buttons

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    User Form with option buttons

    On my user form, I have a few option buttons within different frames. I use [If Then] to allocate the selection to a cell range but the cell is only updated when I click the OK button on the user form:

    Please Login or Register  to view this content.
    If OptionBMW Then Range("Category") = "BMW"
    If OptionMercedes Then Range("Category") = "Mercedes"

    What code can I use for option buttons so the cell address changes as I change my selection on the user form?

    Thank you.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: User Form with option buttons

    You could put the code in the Click events of the buttons.

    Or have a separate sub that runs the existing code and call that from the Click event of each option button.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: User Form with option buttons

    I am not sure what I put after the = sign for the option buttons as what I have tried does not work?

    Please Login or Register  to view this content.
    Thanks in advance

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Can you attach a workbook with an example form with option buttons?

  5. #5
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: User Form with option buttons

    Thank you.
    Attached Files Attached Files

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: User Form with option buttons

    Try this.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: User Form with option buttons

    Thank you very much for your time and effort. I have tested your code on my test file and it works perfectly. I will now work through the code to understand it and then apply it to my real model.

  8. #8
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: User Form with option buttons

    I have used your code and added some extra options buttons and everything works perfectly. Thank you very much.

+ 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