+ Reply to Thread
Results 1 to 12 of 12

Product Configurator Using dynamic Option buttons.

Hybrid View

  1. #1
    Registered User
    Join Date
    10-11-2011
    Location
    India, Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Product Configurator Using dynamic Option buttons.

    Hi All,

    I'm new to this group and felt exited by going thru various posts. I hope someone could help me with the problem that i'm trying to resolve.
    I'm currently designing an excel based product configurator. I've completed most of it by linking the back end data and now what i'm really looking for is programatically assigning Option buttons for the items under a group so that the end user can select one of the options available under each group.
    please refer to the table below as an example.

    Col-A............Col-B............... Col-C ..............................Col-D........... Col-E
    Group..........Item.................Option Button............T / F(selection)........Price
    -------------------------------------------------------------------------------------------------------------------
    Fruits.............Apple........... Option Button-Y.........True...........Look up based on Col D
    ......................Orange.........Option Button-N.........False
    ......................Grapes.........Option Button-N.........False
    Vegetables....Carrot
    ......................LadiesFinger
    ......................Potatoes
    Beverages.....Pepsi
    ......................CocaCola................................................Grand Tot of Price based on selection.
    ---------------------------------------------------------------------------------------------------------------------
    I got this working by creating Active X option buttons from the control tool box manually. However, the issue is for different products the number of Group's and Items under them may vary. Hence, need for a dynamic logic that can loop thru the data and create Groups and option buttons based on number of cells populated.
    I can re-arrange the data as suggested if that reduces the coding complexity. I'm fairly new to coding so any help with a VBA code that could bring out the desired results would be highly appreciated. Many Thanks !
    Last edited by N_K; 10-14-2011 at 06:38 AM.

  2. #2
    Registered User
    Join Date
    10-11-2011
    Location
    India, Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Product Configurator Using dynamic Option buttons.

    Attaching sample file.
    Attached Files Attached Files

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Product Configurator Using dynamic Option buttons.

    Along with being hard to align, radio buttons are more plumbing than you really need. Here is your sheet back with a "doubleclick" function in column C. Doubleclick to add/remove checkmarks.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    10-11-2011
    Location
    India, Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Product Configurator Using dynamic Option buttons.

    Thanks for your reply ! Apparently, I need to implement a functionality where in only one Item under a group should be checked.at a time or I may end up having wrong total price summed up due to duplication of Items under a group. the example I quoted may not necessarily illustrate that but may be if you consider configuring a PC computer you'll probably understand what I'm talking about better. So under each category I need to select one component to build my system and the total should sum up the price of my configuration.
    Thanks !

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Product Configurator Using dynamic Option buttons.

    As long as your layout doesn't change, this will work. When you doubleclick in C, it will check column A to determine the First Row (FR) of the "section" and the Bottom Row (BR) of the section. Then it will clear any existing checkmarks in that section prior to putting in a new one.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-11-2011
    Location
    India, Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Product Configurator Using dynamic Option buttons.

    I tried selling this solution to my audience but unfortunately they are more inclined to have option buttons instead. ( used with the legacy system that was managed manually ).
    you've been very helpful in providing a solution but if you could suggest me something that I could work up that'll be really great.
    Thanks again !

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Product Configurator Using dynamic Option buttons.

    Oh, I did that. The use of form objects ON the sheet I believe to be clumsy and results in an endless amount of maintenance (by you... or us...) anytime you make the smallest of changes to your data.

    I would do it the way I showed you proudly and insistently.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: Product Configurator Using dynamic Option buttons.

    Hi N_K,

    I agree with Jerry. Putting radio buttons on an excel sheet just complicates the problems. His method of double clicking in column C to get some data in the cells is much cleaner when working with Excel. We see problems like this frequently, where a background color or font changes and the user wants to do things based on this cell format. It is VERY hard to capture cell attributes compared to data in a cell.

    I'd suggest you imply that the "legacy" products are old and dying because of overhead like radio buttons. Tell them that two experts on the Excel Help Forum guided you to this new and MUCH BETTER method.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Product Configurator Using dynamic Option buttons.

    In the spirit of giving them the "appearance" of radio buttons without having to actually have them, this version of the same method uses the WINGDINGS font instead to fake radio buttons being selected.
    Attached Files Attached Files

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Product Configurator Using dynamic Option buttons.

    If you want to format a worksheet like a userform, don't use a worksheet but a userform instead.
    Cfr. the attachment.
    Attached Files Attached Files



  11. #11
    Registered User
    Join Date
    10-11-2011
    Location
    India, Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Product Configurator Using dynamic Option buttons.

    snb - Thank you for your help. unfortunately, the original version of my problem has many permutations and combinations of Group and associated items under them and managing a form would not be feasable. However, I have other related tasks for which I can definetely make use of this. Appreciate it !.

    Jerry - I made use of your code and edited it to have radio buttons included which the users are liking. I'll run the show with this as long as I dont end up in trouble. I've saved the file you provided with the method of double clicking and will surely make use of it as an " Enhancement " for the future :-)
    btw, the updated appearance to resemble a radio button is cool...
    Thanks again !

    Here's my scribble making use of what you had provided originally... let me know what you feel about it.. ( File Attached aswell )
    Option Explicit
    Sub Add_Option_Button()
    Dim cell As Range, MyRNG As Range
    Dim BR As Long, FR As Long, LR As Long
    Dim Target As Range
    Dim group_name As String
    Dim counter As Integer
    counter = 1
    If ActiveSheet.OLEObjects.Count > 0 Then
        ActiveSheet.OLEObjects.Delete
    End If
    Range("D:D").ClearContents
    Range("A1").End(xlDown).Select
    While ActiveCell.Text <> ""
        group_name = ActiveCell.Text
        Set Target = Range(ActiveCell.Address)
        FR = Target.Row
        LR = Range("B" & Rows.Count).End(xlUp).Row
        BR = WorksheetFunction.Min(LR, Range("A" & Target.Row).End(xlDown).Row - 1)
        Set MyRNG = Range("C" & FR, "C" & BR)
        For Each cell In MyRNG
        With ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
        DisplayAsIcon:=False, Left:=cell.Left + 5, Top:=cell.Top + 2, Width:=cell.Width - 6, Height:=cell.Height - 3)
            .Name = group_name & counter
            .LinkedCell = cell.Offset(0, 1).Address
            .Object.Caption = ""
            .Object.SpecialEffect = 0
            .Object.GroupName = group_name
            
        End With
        counter = counter + 1
        Next cell
        ActiveCell.End(xlDown).Select
    Wend
    Range("A1").Select
    End Sub
    Last edited by N_K; 10-14-2011 at 06:52 AM. Reason: adding code tag.

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Product Configurator Using dynamic Option buttons.

    the original version of my problem has many permutations and combinations of Group and associated items under them and managing a form would not be feasable
    I very seriously doubt your assertion a form would not be feasable.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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