+ Reply to Thread
Results 1 to 9 of 9

Call different macros using multiple control checkboxes in a userform

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    Lafayette, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Call different macros using multiple control checkboxes in a userform

    Hello All,

    I have 12 checkboxes in a userform. I want to be able to select all 12 checkboxes if needed. Based on which chexboxes are selected, I want to call a specific macro. Since I want to be able to select more than one checkbox, I need the code to loop until all cases have been checked and executed. I cannot seem to get the attached code to call the macros. When I run the code, I do not get any errors, but nothing happens. Any ideas?


    Please Login or Register  to view this content.
    I have an elseIf statement that follows this code, but I figured if I can get this portion to work correctly then I could figure the rest out. I did not feel it was necessary to include all 12 of the checkboxes in the above sample code.

    Be gentle, I'm new to VBA.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,626
    Have you considered a listbox?

    It could display the list of your values, ie Circulating Rates, Injection Rates, Acid etc.

    The listbox could be set up to allow the user to make multiple selections.

    Then rather then looping through controls on a userform you could loop through the list in the listbox.

    Oops, just realised I might be sounding as though I'm trying you sell you a listbox.

    Sorry about that, why not just have a think about it?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    Lafayette, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Call different macros using multiple control checkboxes in a userform

    I'm not very familiar with a listbox. Let me go into more detail of what I'm trying to accomplish and then if you think I would be better off using a listbox I will give it a whirl.

    Essentially I have a Userform where I have 4 options (veesel, infuser, blender, pda). Based on which option is selected, the code will then import my data file which is unique to one of the 4 options above. (This part of my code works). Once the file is imported, then the code i previously pasted above is executed when I click a commandbutton (Graph). I will be graphing based on the imported data file up to 12 charts. Some of the Charts will be graphing the same columns of data, but I will only change the title of the worksheet in which the graph is genereated. Based on that criteria, would I be able to reference the title of the worksheet generated when my charts are created i.e. Circulating Rates, Acid, etc to the values in the listbox?

    I'm all about keeping it simple, but I'm getting in over my head and have no experience with listboxes. If you think listboxes is the way to go, I will give that a whirl and report back when I have something to show.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,626
    Could you upload a sample workbook?

  5. #5
    Registered User
    Join Date
    09-03-2013
    Location
    Lafayette, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Call different macros using multiple control checkboxes in a userform

    Copy 2 of ZZZZZZZ Grapher.xlsm


    I imported the data file that I have been experimenting with in the Job Data sheet.

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

    Re: Call different macros using multiple control checkboxes in a userform

    I think the problem with the current code is this,
    Please Login or Register  to view this content.
    it should be probably be this.
    Please Login or Register  to view this content.
    When I make that change the code runs and creates various charts, based on the checkboxes' the user checked.

    So try making that change.

  7. #7
    Registered User
    Join Date
    09-03-2013
    Location
    Lafayette, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Call different macros using multiple control checkboxes in a userform

    Man... can't thank you enough. I appreciate the help. Sometimes it seems so simple.

    I realize that the code is going through multiple iterations, but in the future is there a different approach I can take with the code to speed up the results of the charts?

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

    Re: Call different macros using multiple control checkboxes in a userform

    Not sure what you mean.

    Is the code not doing what it's meant to do?

  9. #9
    Registered User
    Join Date
    09-03-2013
    Location
    Lafayette, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Call different macros using multiple control checkboxes in a userform

    No, it is working properly. Disregard my last question, and thanks again for the help.

+ 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. [SOLVED] Running Call Procedures & Macros on all Worsheets in Workbook axcluding a Control Sheet
    By Rikkdh in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-03-2013, 05:57 AM
  2. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM
  3. Userform: Can you capture the selections from command buttons and call macros on close
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2013, 06:34 AM
  4. [SOLVED] checkboxes to run multiple ranges of macros
    By ShoshanaM in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 02:56 AM
  5. Userform Call Macro on Control Change
    By fire_water in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2009, 12:42 PM

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