+ Reply to Thread
Results 1 to 8 of 8

Issue searching for text within a list on one Worksheet from cell values in another

  1. #1
    Registered User
    Join Date
    12-21-2017
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2010
    Posts
    4

    Wink Issue searching for text within a list on one Worksheet from cell values in another

    Hello,

    This is my first time posting for help on VBA - I don't do it that often and I am frequently wrong with the syntax.. I would appreciate any help that anyone can provide.. this is a fairly critical functionality that I need to have for one of my files.

    General Overview:
    A customer will expedite a list of document numbers (their numbers). These numbers can correspond to multiple document numbers in my world. Additionally, Document numbers in my world may correspond to multiple customer document numbers.
    Example:
    Customer wants X ---> For me to fulfill X, I must give A and B. However, A may be linked to a customer document of X and Y. If I search my list for X, I want to be able to return every document in my world that is linked to X and copy over the data from my document management system. Similarly, if the customer would expedite for Y, A would be returned.

    I'm having issues with searching for a string of text.. setting the customer's document number = to text and searching through my list of their document numbers to find that text, and then return a range of data on another worksheet, next to the document number they are expediting for. If there are multiple returns, I'd like a new row to be inserted below their document number to add the information, so that they can see what all goes into that one document they are looking for, with the range of cells I want copied over to the new Worksheet next to that. Every time I think I solve an issue, I get a different Run-time error.. sometimes "91" or "1004" or Selection errors.

    Here is the below code that I started, if you have any questions, please ask.
    ========

    Please Login or Register  to view this content.
    Last edited by jsturbo; 12-21-2017 at 12:39 PM. Reason: Problem Solved! (See Attached Solution Code)

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

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

  3. #3
    Registered User
    Join Date
    12-21-2017
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    Hello,

    Thank you for the information - I have attached the desensitized sample file.

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

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    try this out, you will have to fiddle with the offsets to get the correct cells values.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-21-2017
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    Hello,

    You are a LIFE SAVER! This was what I needed! However, I did modify it a bit (please see below for reference of the final code). I tested this code with my actual data and it works - until the next issue comes up, but that would be a separate thread if necessary

    I'll change the status of the post to "Solved" and also add the final solution file.

    Thank you again very much, this has saved me a measurable amount of time!
    Happy Holidays!

    Please Login or Register  to view this content.

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

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    Excellent, you can also remove the msgbox line, I just used it to make sure the code was working properly.

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

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    You could also replace your loop to find blanks...
    Please Login or Register  to view this content.
    Replace with this little code
    --------------------

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-21-2017
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Issue searching for text within a list on one Worksheet from cell values in another

    Thank you! I often make the code much more complicated tan it needs to be..
    What if a situation exists where the text I want to find exists in the data I'm looking into, but without a space? (example below)
    Want to find: "DOC_A-12_(A)"
    COULD BE In my data as: "DOC_A-12_(A)" OR "DOC_A-12(A)"
    The long way I've taken to correct the "human data entry error" is to just remove the space manually.

+ 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: 7
    Last Post: 12-14-2015, 01:20 PM
  2. Searching for text strings in one cell, returning values from another
    By AwagentX in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-20-2015, 04:42 AM
  3. Searching / Selecting Text Values from Data List
    By craigmcmenemy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-04-2014, 06:53 AM
  4. Searching for Text within a worksheet, and selecting the cell
    By Darth269 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2014, 09:41 PM
  5. Replies: 9
    Last Post: 09-13-2013, 10:16 PM
  6. Copy or Cut userform text/list box values to a worksheet cell for printing
    By sumitos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2013, 05:38 AM
  7. Help Searching Text List and Calculating Values
    By Kbass01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-23-2008, 11:23 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