+ Reply to Thread
Results 1 to 10 of 10

macro to autofill template depending on box input

  1. #1
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    macro to autofill template depending on box input

    I have a code that I have written to help fill in cells on a new sheet...
    tho this code seems to be working fine...it seems to be a bit "bulky" and is kind of a pain to read thru and make corrections/changes....so i would like to condense it some...if possible

    also, i would like to use either a drop down box OR option buttons to do this instead of the input box i'm using.... tho i'm not sure how to do this....any help would be great

    ...i tired to leave the code here but it was too long to be able to post, so i attached the file...which is probably the better thing to do so you can understand exactly what i'm trying to get done here .....the vba i'm talking about is labeled "ITMsheetAutofill"

    JWO_testbook.xlsm

    any other suggestions on what i have going on here in this book would be great
    Last edited by vsophof; 03-18-2012 at 06:12 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: macro to autofill template depending on box input

    Hi,
    What is it you are trying to accomplish?

  3. #3
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: macro to autofill template depending on box input

    With the autofill macro, I would like it to bring up a box where the user can select what inspection frequency then choose equipment type and it autofills certain cells accordingly.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: macro to autofill template depending on box input

    Quote Originally Posted by vsophof View Post
    With the autofill macro, I would like it to bring up a box where the user can select what inspection frequency then choose equipment type and it autofills certain cells accordingly.
    Yes,
    Your attachment has over 25 modules most of them being empty, and all your sheets tabs are hidden.
    Please supply a sample workbook that we can all understand.
    It needs to show your original layout and what your desired outcome should be.

  5. #5
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: macro to autofill template depending on box input

    Ok, I will when I get back to the house.
    Thanks

  6. #6
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: macro to autofill template depending on box input

    here is the file...i didn't realize i had so many empty modules...so i deleted all the emptys....module 24 has the macro i did that i would like done differently...it can also be run by ctrl-l....
    i made all the tabs visible, and the tab " " is the template i use... (yes i used (space) as a tab name).... the tabs labeled oc-##### are examples of what kinds of stuff i want to be autofilled.... equipment type, inspection freq, etc...

    i'm trying to create this book for a guy who isn't very computer literate at all...i would just like him to be able to click on the information instead of having to type in a number...even a drop down box would be great....currently its set up on two boxes popping up back to back...if i could get it as one where you can make two selections in one box...that would be better...

    hopes that makes sense....
    JWO_test_book.xlsm

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: macro to autofill template depending on box input

    I can imagine the hours and hours you have spent on this.
    Another way to comunicate with the user is to use a userform, that way you would not have to be limited to just one question like an input box.
    I have attached a very simple userform example.
    This link will show you how to build a userform for a textbox
    http://www.davesexcel.com/createauserform.htm

    You can google Excel Userforms and will get lots of hits.

    Removing selects in code helps run the code much faster as well

    Please Login or Register  to view this content.
    Can be coverted to.

    Please Login or Register  to view this content.
    I believe you sill have to have cells selected though when adding borders.

    Another thought is to use a Sheet Template and copy it for your next job form.
    the code....
    Please Login or Register  to view this content.
    Only two lines of code, you could have one for each catagory and have them hidden.
    Attached Files Attached Files
    Last edited by davesexcel; 03-17-2012 at 01:47 PM.

  8. #8
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: macro to autofill template depending on box input

    I can make that work nicely! The only thing i would like to change is to make combobox2 to display its contents based on the value selected in combobox1...
    how would i go about that?

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: macro to autofill template depending on box input

    Check this out, the code should work for a userform
    http://www.davesexcel.com/dependentcombobox.htm

  10. #10
    Registered User
    Join Date
    11-09-2010
    Location
    South, Texas
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: macro to autofill template depending on box input

    TYVM! that worked out great

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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