+ Reply to Thread
Results 1 to 45 of 45

User Form to search and return data over multiple cells and worksheets

  1. #1
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    User Form to search and return data over multiple cells and worksheets

    Hi All,
    I was wondering if any one could help with a some coding that i'm trying to find.

    I have created a userform which contains a textbox, which i will be copying multiple rows into from another workbook. i was wondering if anyone has ever created some code to the copy the information into a worksheet which is selected based on a combobox and the return all the information based on the column in the worksheet.


    When you look at the workbook, the userform is on selection of the parts list tab on the front sheet, i then want to copy all the information into column C on worksheet "P" for example, and then all the other information is added to the other cells.

    I have attached my excel sheet for your assistance, the

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Hey Nathan

    This will get you started:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 03-20-2017 at 09:22 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Thanks, i will check this out see what i can do with it.

    Is it possible to have multiple lines on a text box at the minute i can only get 1 line, and i want to copy around 50 lines in at the same time.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets


  5. #5
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Got that thanks!

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    For interest sake, why would you want to copy 50 lines into a textbox.

  7. #7
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    At the minute i have 2 worksheets, and that is populated automatically from a different program, i'm trying to find a quick and easy way to copy all the information into my worksheet and then create a vlookup for all my information.

  8. #8
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    so my long term goal is to be able to copy the information into a worksheet "power" for instance in a set column and then do a search for all the other information that is located across different worksheets.

    Capture.JPG

    it will be a bit like the attached
    Last edited by nathandavies9; 03-20-2017 at 10:02 AM.

  9. #9
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    it would then be inserted in to the worksheet on the parts list column like so.

    Capture1.JPG

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Over my head...whoosh. Will have to load sample files and detail required result.

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    So, you want to import the textbox info into one column each wit it's own row and then have a vlookup formula in the other columns to get required information.

  12. #12
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    This is my workbook, and everything i have completed so far.

  13. #13
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Yes, it will have to search the full workbook and then find the relevant information.

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Think you gonna have to use a multiselect-listbox instead of textbox.

  15. #15
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    would i still be able to copy from another worksheet?

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets


  17. #17
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    This is more for inputting the information and then inserting into a ws, i have extracted the insert but i'm looking to completely automate it, from the copy and paste.

  18. #18
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets


  19. #19
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Thanks Sintek, i will look at these see what i can come up with.

  20. #20
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Hey there Nathan

    i suggest using a listbox and then run code to fill the selected sheet

    Something like this:
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    I'm not sure where to put this in the code? i'm just getting started with code so i'm struggling at the minute.

  22. #22
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Hi Nathan

    Has been a lot of back and forth going on but this is unfortunately the game - not knowing what one's exact requirements are. I have attached a sample workbook which auto populates a listbox from an array and then when add is pressed, it puts the items in a chosen sheet below each other. Play around with this as I am certain that this is what you require.
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Hi Sintek,
    Thanks for your help on this, I have looked at your code and i think its very close to what i require but rather than having a list box i require a text box because i will be inputting the information myself.

    I will have two documents open at the same time "Sample_BOM" and "Heat Calculation", what i will be doing is copying the information from Column C "part Number" of the Sample_BOM into the text box one userform1, then i would press the add button on userform1 which would then input that information into which ever worksheet i selected so in this case it would be ws:POWER.

    I have attached both sheets for your information.
    Attached Files Attached Files

  24. #24
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Nathan, Do me a favour

    Open the two attached workbooks and run the code.
    This works as per your explanation in Thread#23, only difference is that the listbox is autopopulated by The Sample_BOM worksheet - No need to copy and paste.

    Choose "POWER" From ComboBox1
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    sintek, that works beautifully!!

    I know have one more little request, is it possible to put the next column in as well. Column D?

  26. #26
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Put this code in the UserForm_Initialize event. This will populate listbox with Column c and d.
    Still trying to figure out the other part lol......Still learning as well.
    Please Login or Register  to view this content.

  27. #27
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    This code pastes the listbox values to corresponding sheet Columns C & D
    Please Login or Register  to view this content.

  28. #28
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    sorry! just seen the next response. that works perfectly, i just need to find out how to complete a vlookup based on Column C once its pasted into the column.
    Last edited by nathandavies9; 03-20-2017 at 01:57 PM.

  29. #29
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    I have been looking at how to populate the remaining cells and i think the best way will be INDEX AND MATCH, I'm trying to work it out now but not sure how to get it to work across every worksheet automatically.

  30. #30
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Where must it take it's value from. Upload a sample with results highlighted

  31. #31
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    I have highlighted the cells which will require populating and the worksheets which they should be populated from (also highlighted on there)

    attached is a copy.
    Attached Files Attached Files

  32. #32
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    it will not be limited to these 2 worksheets, there are around 16 worksheets on the final document.

  33. #33
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets


  34. #34
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Going to have a problem as the part no's don't match i.e.
    5SY61047 vs 5SY6104-7 etc

  35. #35
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    I will be double changing all the part numbers so that they match just not got round to it yet.

    i have changed them on this example sheet
    Attached Files Attached Files

  36. #36
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Once you sort that out, copy this formula into Column E and paste down invoking with CONTROL+SHIFT+ENTER
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  37. #37
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    For the next column, change this part of the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and so on

  38. #38
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Forgot to mention. Somewhere on a open sheet, write down all the sheet tab names and name this range "MySheets"

  39. #39
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Its got an error, #Name? doesn't seem to work

  40. #40
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Got an different error now = #Value?

  41. #41
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    Fixed the error.

    Will complete some testing tonight but thing that is now working!

  42. #42
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Nathan, herewith attached a sample sheet with results highlighted. MySheet range is Sheet1 Range B1:B2
    You should be able to sort out the rest
    Attached Files Attached Files

  43. #43
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Remember to mark as solved and add Rep Points

  44. #44
    Registered User
    Join Date
    02-21-2017
    Location
    Castelford
    MS-Off Ver
    2013
    Posts
    89

    Re: User Form to search and return data over multiple cells and worksheets

    SINTEK!

    You have been a massive help today and i think i have got everything i need now! i will defiantly add rep and mark as solved

    cheers
    ND

  45. #45
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,234

    Re: User Form to search and return data over multiple cells and worksheets

    Only a pleasure...This Forum is the SH..!!!
    Excellent advice and assistance 24/7
    I would be lost without it

+ 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. Replies: 6
    Last Post: 12-02-2015, 03:32 PM
  2. User form with search and update function with multiple column/Data
    By onyony34 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-08-2015, 03:05 AM
  3. User Form to carryout multiple (Fixed) searchs against data and return results in new WS
    By MaterialSpecialist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2013, 12:55 PM
  4. [SOLVED] Re: Please help for Excel User form send data for multiple worksheets
    By gopala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 04:08 AM
  5. [SOLVED] User Form to execute search and return all values to the user form for editing
    By allwrighty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 10:40 PM
  6. how to use VBA to search and return search result in the user form
    By pearlynie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2013, 07:58 AM
  7. User Form to Search multiple Criteria to return multiple Results
    By Calieth in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-16-2011, 11:57 AM

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