+ Reply to Thread
Results 1 to 15 of 15

user form to run macros to populate data in sheet..

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    user form to run macros to populate data in sheet..

    hey all,

    have a Sheet that a fill data constantly into everyday all day..

    i created a user form

    and this is the layout i want.. and i have created a macro for each check box...

    when i click on any one of the check boxes i want to click ok, and have the corresponding macro run in the sheet.

    i have attached the form. the sheet and a sample macro... if someone can write me the one line of code for this to happen i can just simply replicate the other 39 my self.
    i have attached the macro and would like it to correspond with the check box.

    any help MUCH appreciated.

    book12.xlsm

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: user form to run macros to populate data in sheet..

    Inserted a button on your spreadsheet to open user form. Linked OK button to your macro. See attached.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    i tried to write a reply did not go through... least its not showing up hope this is not a re-do.

    worked great, guess I am worse at excel than i thought, thought would be an easy string to replicate..

    but the code string does not mention the checkbox or anything just links right to command button so how do i go about adding seperate checkboxes to the code for different macros if that one checkbox is linked directly to the button..

    i was expecting something alone the lines of calling macrocs if check boxes were true etc. I guess just wondering how to add a separate checkbox with aseperate macro

    thanks again

  4. #4
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    i tried to write a reply did not go through... least its not showing up hope this is not a re-do.

    worked great, guess I am worse at excel than i thought, thought would be an easy string to replicate..

    but the code string does not mention the checkbox or anything just links right to command button so how do i go about adding seperate checkboxes to the code for different macros if that one checkbox is linked directly to the button..

    i was expecting something alone the lines of calling macrocs if check boxes were true etc. I guess just wondering how to add a separate checkbox with aseperate macro

    thanks again

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: user form to run macros to populate data in sheet..

    Let me make sure I understand.

    You will have multiple checkboxes. If one is checked then you wish to run specific code for that checkbox? What if more than one checkbox is checked? what should happen? I am thinking that instead of checkboxes you probably want to have radio buttons so that you can only check one at a time.

    Then I would suggest that based upon the radio button, you have a Select Case statement and list the macros to run for each radio button when the OK button is selected. I apologize if I did not understand your initial request correctly.

    Alan

  6. #6
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    yes exactly,

    i plan on having 40 checkbxes or radio buttons, each assigned to seperate macros which fill data into that sheet.

    select, click ok watch it fill!

    you nailed it.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: user form to run macros to populate data in sheet..

    Suggest you build your form with radio buttons and then post it, then we can work on creating a Select Case statement for at least two situations and then based upon that, you can create the remaining 35+ scenarios.

    Because I don't really understand what you want your Macro(s) to do, I am wondering if there might be an easier way than building 40 macro statements. If you would take the time to write out what you want your macro(s) to do, we might be able to offer up a better solution. Try to be clear and concise. Use the spreadsheet you have posted as your example.
    Last edited by alansidman; 09-10-2014 at 07:09 PM.

  8. #8
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    deal,

    will post tomorrow am

  9. #9
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    here it is,

    form is attached, when click megger button,

    want each radio button assigned to each macro with same name... all are in there if someone can get me started ill handle the rest!

    thanks all

    111.xlsm

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: user form to run macros to populate data in sheet..

    I started to work on this, but noted that after the first 10 option buttons, the names of the buttons do not correspond to their label. It would be easier to create code if the button names corresponded to their label and the macro to be called. As a developer, this will make is easier to debug any code you have should the need arise. Once that has taken place then you can use code similar to the following:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

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

    im retarded?
    Last edited by alansidman; 09-11-2014 at 01:08 PM. Reason: Added Code Tags. Please read rules about code tags

  12. #12
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    nothing happens cant even click on

  13. #13
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    Please Login or Register  to view this content.


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

    tried this also..

    complie error unexpected varible.. highlights call FOUR
    Last edited by alansidman; 09-11-2014 at 01:08 PM. Reason: code tags added.

  14. #14
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,951

    Re: user form to run macros to populate data in sheet..

    Not sure why you are getting a compile error. Look at this tutorial as it explains exactly (I believe) what you are trying to do.

    http://www.homeandlearn.org/excel_vba_subroutines.html

    By the way. Please read our rules about code tags. I fixed them for you this time, but in the future you will need to add them yourself or you may feel the wrath of a less amicable moderator.

    Alan
    Last edited by alansidman; 09-11-2014 at 01:31 PM.

  15. #15
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2013
    Posts
    18

    Re: user form to run macros to populate data in sheet..

    sorry guys forgot my computer at work and phone and everything else electronic,

    gave up nothing worked so just running the macros from macro menu without the form, works fine just slower all good

+ 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. Populate user form with current data
    By Tmay333 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2013, 03:02 PM
  2. Calling a user form initialize sub when entering the form to populate combobox...
    By regupnorth in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2012, 07:24 AM
  3. Using macros to populate data from a form
    By abhi2407 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2012, 06:46 PM
  4. macro user form populate sheet
    By johncrofts in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2011, 05:22 AM
  5. Populate data from form to excelsheet as its already happening using macros
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-12-2011, 02:52 AM

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