+ Reply to Thread
Results 1 to 5 of 5

Combo Box (Form Control) With Macro On A Graph Sheet

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Question Combo Box (Form Control) With Macro On A Graph Sheet

    Guys, I have another interesting challenge. I have a sheet, which is a graph (e.g. when you select a graph, right click > MOVE TO NEW SHEET). On that graph-sheet I need to add a "Combo Box (Form Control)" and attach a separate macro to each of the list points in the box. Meaning, when I choose entry one one a list, macro 1 is run, when I choose entry 2 on a list, macro 2 is run, etc.
    I dug up that this IS possible using an ActiveX object ["Combo Box (ActiveX Control)"]. However, since the whole graph is a separate sheet, I can't put (area s grayed out) a "Combo Box (ActiveX Control)" object onto it and hence I can't use it.

    So my questions are:
    - Is it possible to somehow put Combo Box (ActiveX Control) onto a such a graph-sheet?
    - Is it possible to realise what I need via Combo Box (Form Control) object somehow? (how to attach a separate macro to each list entry)

    Again, the punchline of what I need to do is: with selection of each entry from a list of my Combo Box (Form Control)/Combo Box (ActiveX Control) a separate macro should run, e.g. with 10 points in the list 10 macro will be assigned, with each macro running when a corresponding list point is selected.



    Any help would be much appreciated!
    Last edited by splendidus; 05-30-2012 at 12:15 PM.
    Office 2019 16.0.13205.200000 64-bit

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Combo Box (Form Control) With Macro On A Graph Sheet

    Has to be a Form control, ActiveX controls are not supported, on chart sheets.

    Assign a macro to the combo box and within it determnine the action to take based on the value.
    This is for an combo with 3 list items.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Re: Combo Box (Form Control) With Macro On A Graph Sheet

    Quote Originally Posted by Andy Pope View Post
    Has to be a Form control, ActiveX controls are not supported, on chart sheets.

    Assign a macro to the combo box and within it determnine the action to take based on the value.
    This is for an combo with 3 list items.

    Please Login or Register  to view this content.
    Thank you so much for both your kind reply and the example attached! : )))

    My question, however, is: can I make another macro stored in the same workbook run when selecting each point. So, I create a Combo Box (Form Control), attach the macro you suggested to it, BUT selecting each item should run a separate macro: e.g. selecting entry 1 would run/launch macro 1, selecting entry 2 would launch macro two, etc. Those macros are done already (stored in a module like any other normal macro) and I simply need a way to run/call/execute each of them when an entry is selected. So something that would look like:
    Please Login or Register  to view this content.
    I know I can run a macro using a Button (Form Control) object, but there are 30+ items, so putting 30+ buttons on the graph is too much. So I'm looking to do the same (as with buttons) thing using a Combo Box.

    Any chance this could be done?
    Last edited by splendidus; 05-31-2012 at 09:21 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Combo Box (Form Control) With Macro On A Graph Sheet

    Confused.

    Selecting an item from the combo box, in my example, is running different code per item. It just happens that the code it runs is a message box statement.
    You just need to replace those with calls to your macros. Exactly like the code snippet you posted. The reason I'm confused is I thought you would have tried doing exactly that.

  5. #5
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Re: Combo Box (Form Control) With Macro On A Graph Sheet

    Quote Originally Posted by Andy Pope View Post
    Confused.

    Selecting an item from the combo box, in my example, is running different code per item. It just happens that the code it runs is a message box statement.
    You just need to replace those with calls to your macros. Exactly like the code snippet you posted. The reason I'm confused is I thought you would have tried doing exactly that.
    Andy, (my) issue is solved! The thing was that I was using a complete macro code instead of cutting out sub part in the beginning and end sub part at the end (and thus not using "pure" code).
    Overall, your solution worked like a charm, thank you so very much! You're literally a life-savior!
    Last edited by splendidus; 06-05-2012 at 04:08 AM.

+ 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