+ Reply to Thread
Results 1 to 17 of 17

option button help please

  1. #1
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    option button help please

    Good afternoon all,

    I am having a little trouble trying to figure out how to get an option button working ..
    I have attached a sample of what I have so far and what I would like to do is:-

    I have put 3 option buttons on my user form ... I would like them to add 25% and 50% to the textbox results that are selected..

    You select Index material and description .. this will give 30 prices on the form ... I then wish to have standard (by default) and the other 2 options to be selected as needed

    Many Thanks in advance
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: option button help please

    I would start by putting the original value somewhere, say the tag of the text box, then on the click, loop through the text boxes adding the %ge to the tag value.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Thanks Nathan,

    Tag of the text box?? .... Sorry ... lost already ...

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

    Re: option button help please

    Add this sub.
    Please Login or Register  to view this content.
    Now change the ComboBox3 click event to this,
    Please Login or Register  to view this content.
    add this code for the option buttons.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: option button help please

    Hi,

    Try the following:

    Change ComboBox3_Click to:
    Please Login or Register  to view this content.
    Add the following code in the UserForm module:
    Please Login or Register  to view this content.
    Lewis

  6. #6
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Thanks Norie

    Perfect!!!!

    Hours of head scratching all came down to 3 little bits of code ......

    Thanks

  7. #7
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Thanks LJMetzger

    That works as well ... 2 solutions to the same problem ... Much appreciated


  8. #8
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Norie, LJMetzger,

    I thought it worked ... it seemed to ..... but then I found it was also messing with the minimum order (green) result too ..... is there any way it will leave that textbox unchanged???

    Thanks

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

    Re: option button help please

    This should skip the Min Order textbox when necessary, ie when 25%/50% are selected.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Norie..

    Yay!! Thanks

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: option button help please

    My solution should leave the minimum order box intact.

    Lewis

  12. #12
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Thanks Lewis ... I am currently testing your solution to this as I somehow managed to force a runtime error using Norie's ...

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

    Re: option button help please

    What error are you getting?

    PS Both codes change the value in the Min Order box.

  14. #14
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Norie ... Yes they do .... I am getting:- Run-time error '13': Type mismatch

    When I start the debug

    .Controls("TextBox" & I).Value = _
    dic(.ComboBox1.Value)(.ComboBox2.Value)(.ComboBox3.Value)(I) * (1 + dblMarkUp)

    is highlighted.

    This may have been because I selected the option button BEFORE comboboxes???

    Thanks

  15. #15
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: option button help please

    dic(.ComboBox1.Value)(.ComboBox2.Value)(.ComboBox3.Value)(I) probably has to be cast into a number (if it is numeric), otherwise it should be left as text (e.g. 'Minimum').

    I was getting the same runtime error when I was testing my preliminary code.

    Lewis

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

    Re: option button help please

    I think it is because you've selected the option button before the comboboxes.

    There's a few ways you could deal with that.

    Probably the simplest would be to disable the option buttons in design view or at startup and add code to the Click event of ComboBox3 to enable them.

    Actually, it would be even simpler to disable the frame they are in.
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    03-01-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: option button help please

    Thanks Norie,

    That worked .. Also had to zero out 'Minimum' .... I guess it cant multiply a word so flags the error ....

    All seems to be working now ...

    Thanks and rep to you and Lewis

+ 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: 2
    Last Post: 08-15-2013, 12:25 PM
  2. Hide a picture button placed in all sheets using a option button (form control)
    By lagaranch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-26-2012, 10:33 AM
  3. Userform Option Button to Show/Hide Another Option Button on same Userform
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2010, 09:44 AM
  4. Replies: 2
    Last Post: 03-27-2007, 08:30 AM
  5. [SOLVED] keep source formatting is not an option in paste option button
    By Tina in forum Excel General
    Replies: 0
    Last Post: 02-20-2006, 06:00 PM

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