+ Reply to Thread
Results 1 to 27 of 27

Input data macro

  1. #1
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Input data macro

    Hi all,

    I am looking for a macro which will help make my workbook more user friendly.

    Is it possible to have a macro which when run brings up dialog boxes for user input into certain sheets etc.?

    If so then please tell me and I can tell you more what I need.

    Thanks.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Input data macro

    yes it is possible
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok brilliant well heres what I would like:

    When the macro is run I would like the first dialog box to select which sheet the data will be imported to.

    Then the next three boxes to be data that will be imported into seperate cells on that sheet in the next available cell down in that column also.

    Then at the end, if possible, a box coming up saying whether they want to import data again, so in effect clicking yes will run the macro again.

    I think that should be it.

    Any help will be great.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    See if attached example get's you started

    http://www.contextures.com/xlUserForm01.html

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    All of this confuses me as i am not so gd with macro code.

    Could u write some for me going by wat i sed b4.

    Thanks.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    wat i sed b4.
    Didn't fully understand it. A example and a file may help

    VBA Noob

  7. #7
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok i will explain...

    I have a workbook containing stock of different diameters of bars of steel, which are in different sheets.

    So I need a macro that when run, will open a dialog box asking for the sheet name, diameter, length of bar and material type.

    Then when ok or whatever is pressed, that information is put into the specified sheet dependant upon the type of material, so...

    If the material is "H13" then the diameter needs to go in the next available space between cell numbers C3-C18 and length between D3-D18.

    If material is "H11" then diameter in next available space I3-I18 and length J3-J18

    If material is "2714" diamater next space between M3-M18 and lenth N3-N18.

    If material is "E38k" diameter next space R3-R18 and length S3-S18.

    Hope this helps u help me.

    Thanks

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    A example file would be better.

    VBA Noob

  9. #9
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Smile Re: Input data macro

    Hi,

    If you could attach the file, I could write a customized code and attach it back.

    --Karan--

  10. #10
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    I have tried to attach the file on the forum but it, for some reason, always says there is an error, so if either of you could tell me ur e-mail then I will send it that way.

    Thanks

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    What error message?

    Just click the paper clip icon > Browse > upload or use a free upload site and attached the link

    http://www.rapidshare.com/

    VBA Noob

  12. #12
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok heres the link to the file:

    Link removed by mod as personal info on workbook

    This isn't the most up to date version so the cell refs i gave b4 are not the same but u can see what I mean by looking at it.

    Hope u can all help now.
    Last edited by VBA Noob; 04-18-2009 at 06:38 PM.

  13. #13
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    Please remove the link and remove and personal info. Also only need a four or five sheets as an example

    VBA Noob

  14. #14
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Smile Re: Input data macro

    Send me the file by email. I have sent my mail id to you in a personal message.

    --Karan--

  15. #15
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok heres my workbook again without personal info.

    http://rapidshare.com/files/22323532...K_DEL.xls.html

    Theres only three sheets, a lot less than the proper one but I did this to make it smaller, u can see the idea though.

    Thanks.

  16. #16
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok guys now u have the file, heres exactly what I need:

    I would like a userform with the following field names:
    • Sheet Name
    • Diameter
    • Length
    • Grade

    Obviously the sheet name will be the selection of the sheet, then when this sheet is selected all the other information will go into it...

    If the "Grade" is H13, the diameter put in will go in the next available space between cells B13-B22 and the length alongside the diameter in column C obviously

    If the "Grade" is H11, the diameter put in will go in the next available space between cells G13-G22 and the length alongside the diameter in column H obviously

    If the "Grade" is 2714, the diameter put in will go in the next available space between cells L13-L22 and the length alongside the diameter in column M obviously

    If the "Grade" is E38K, the diameter put in will go in the next available space between cells Q13-Q22 and the length alongside the diameter in column R obviously.

    So what is put in depends on where the infos put into.

    On the userform I would also like an "OK" and "Cancel" button AND when a form is complete and info put into its place then I would like a message to ask the user if they wish to put another item into the workbook which will run the process again if yes is clicked.

    Hope this helps.

    Thanks.

  17. #17
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    See if this helps

    Code used

    http://rapidshare.com/files/22329923...EL_1_.xls.html

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

  18. #18
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok thanks for doing that for me but there are a few probs with it:

    What I put in diameter used on user form it puts in width and then it puts the width in diameter.

    Also obviously as u sed in ur PM its not exactly what I wanted, so if u could modify it for me to my specs that would be brilliant.

    And one last thing, the show form button, if u could put it on the same sheet as its on but on the next page.

    Thanks

  19. #19
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Sorry for post again but another thing i have just noticed is that if I deleted an entry at the top, it wont replace that entry when I enter a new item.

    Can that be sorted?

  20. #20
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    same sheet as its on but on the next page
    Don't follow

    Also obviously as u sed in ur PM its not exactly what I wanted, so if u could modify it for me to my specs that would be brilliant.
    As I say post need to stay in thread so I deleted it

    What I put in diameter used on user form it puts in width and then it puts the width in diameter.
    Amended code

    Please Login or Register  to view this content.
    VBA Noob

  21. #21
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    Quote Originally Posted by jamer02 View Post
    Sorry for post again but another thing i have just noticed is that if I deleted an entry at the top, it wont replace that entry when I enter a new item.

    Can that be sorted?
    What do you mean by this line. I will stop helping unless you explain clearly as this means nothing to me
    deleted an entry at the top
    E.g Delete what and where?

    VBA Noob

  22. #22
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Ok I will try to explain better...

    When I have all of the entrys full up in a certain grade there is no room obviously for any more entrys and as I go along I will be deleting some entrys because bar's will be sold etc.

    So, to simplify, if i delete say the 1st entry of a certain grade, there will be a space for another item there, so I would like the macro to put all the info in the next available blank space in that column, whether it be at the top or in the middle of the pack.

    Hope that is better explaining for u.

    Also, I need you to add the grade "E38K" to the macro.

    Thanks for this, if u manage to do this for me I do have an extra thing I may want in it but isn't essential yet so I'll let u carry on with this 1st.

  23. #23
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    BTW how do I access the macro code u have written to modify it to the updated code?

    I click on macros but there is nothing.

    Strange.

  24. #24
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    So, to simplify, if i delete say the 1st entry of a certain grade, there will be a space for another item there, so I would like the macro to put all the info in the next available blank space in that column, whether it be at the top or in the middle of the pack.
    Just record a macro to sort the data and attach a button for each sheet

    Also, I need you to add the grade "E38K" to the macro
    Assumed starts in Col P

    Amended code

    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Just record a macro to sort the data and attach a button for each sheet
    Huh? why would this help? Are u sure u understood what I meant m8?

    I can try explain again if u want no probs.

  26. #26
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Input data macro

    Are u sure u understood what I meant m8?
    I believe I do. I'm suggesting instead of having random rows as per your idea we always add to the bottom which is more structures. The way to do this is when the OP deletes the range the data is sorted and the blanks move to the bottom.

    This is the best I can do for you as other people need help too and I've spent to long on one post. If you want a tailored model I would suggest posting in the Commercial Services Exchange and offering to pay for it. Don't forget we don't get paid for help we offer

    Regards

    VBA Noob

  27. #27
    Registered User
    Join Date
    04-02-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: Input data macro

    Yes and I appreciate ur time very much, maybe karan can help assist too.

    We can leave it for today if u want and let u have a break from it.

    We can speak tommorow m8.

+ 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