+ Reply to Thread
Results 1 to 5 of 5

Create macro that searches multiple named ranges and returns name of the range with data

  1. #1
    Registered User
    Join Date
    10-25-2008
    Location
    Slovakia
    Posts
    31

    Create macro that searches multiple named ranges and returns name of the range with data

    Hello,

    Can you please help me how to write a macro for searching multiple named ranges?

    I have following dynamic named ranges

    List1
    List2
    List3
    List4
    List5
    List6
    List7
    List8

    I would like to search them all (even for similar results, so that the person does not need to type exact match) and return the name of the named range in which the data was found.

    But I do not want to return names List1, List2, etc. but names that I have in a separate lookup table on Sheet2 for these lists,
    list1 colors
    list2 animals
    list3 clothes

    etc.

    So that If I type into a dialog box : "eleph" it would lookup elephant and would return name "animals" that was looked up in the table on sheet2 for list2.

    Thank you very much
    Last edited by mechant; 04-15-2013 at 01:04 AM. Reason: solved

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Create macro that searches multiple named ranges and returns name of the range with da

    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 use the paperclip icon to open the upload window.

    View Pic
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    10-25-2008
    Location
    Slovakia
    Posts
    31

    Re: Create macro that searches multiple named ranges and returns name of the range with da

    Here is my sample workbook.

    sample.xlsx

    I have changed the request a little bit. I have dynamic named ranges List1, List2,List3. I need to create a Msgbox where the user will write his search (not exact match) and It will lookup all named ranges whose names start with "list" ( list1, list2,....listn) in the worksheet and find the closest match. I also have other named ranges with numbers and other stuff and I do not want to lookup in those too, so the named ranges have to begin with "list". The search macro will be on different sheet than all the lists, so it has to use name sheet1 instead of activesheet.

    I need to return cell value "Animals" if the data was found in that table (named range List1). The relative position of the cell with the title of the named range to the position of the named range itself is the same as in my original workbook. So if my named range starts in C6, search macro will return the value of B4, etc.

    Thank you very much

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Create macro that searches multiple named ranges and returns name of the range with da

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

  5. #5
    Registered User
    Join Date
    10-25-2008
    Location
    Slovakia
    Posts
    31

    Re: Create macro that searches multiple named ranges and returns name of the range with da

    Thank you very much protonLeah, I have made the necessary adjustment to my original workbook and it works great. Thank you once again. I owe you.

+ 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