+ Reply to Thread
Results 1 to 8 of 8

Excel VBA to search the string from 'A1' cell

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Question Excel VBA to search the string from 'A1' cell

    Hello Excel Experts,
    I am developing an VBA code when-in i need to match 2 criterias to pull the values for a specific table.
    In the attached file, i have provided the sample data in 2 sheets and the criteria's to match is 'Product1' and 'City1'. With these 2 as criterias, i am determining the table to pull the data/values.

    I have developed the code below but this never considers "A1" in its search. In every Do..Until loop, it gives output of only 'Product1/City2'. What i am doing wrong here.? Why doesn't this code it find 'Product1' of 'A1' cell.?
    Sorry if my question is too silly. Thanks for your advise in advance.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mchilapur; 08-02-2018 at 02:23 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Excel VBA to search the string from 'A1' cell

    Perhaps change with

    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Excel VBA to search the string from 'A1' cell

    And this?

    Please Login or Register  to view this content.
    If you look at cells it looks at the entire sheet, so I do not know why is doesn't look in A1, do remember that Find is case sensitive,
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Excel VBA to search the string from 'A1' cell

    There is no data to find in your attached file!

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel VBA to search the string from 'A1' cell

    What's the ultimate goal here?
    I get the impression that you want to identify a subset of records from a whole table of records and either identify them with a marker or perhaps extract them somewhere else.

    Either way I can't see why you would want to use a VBA loop which is inefficient when you have the inbuilt Excel Data Filter functionality. Just use that and then if you want to mark them just use the

    Please Login or Register  to view this content.
    syntax
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Excel VBA to search the string from 'A1' cell

    @Keebellah

    Please Login or Register  to view this content.
    because it starts AFTER and not included cells(1,1) when no notification done

  7. #7
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: Excel VBA to search the string from 'A1' cell

    @PCI, Your solution works like a charm.. Thanks..

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Excel VBA to search the string from 'A1' cell

    You're welcome
    Enjoy Excel and have a look on the rep's star at the bottom left
    PCI

+ 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: 06-05-2015, 09:28 AM
  2. Script to Search for a specific String then return cell values above that String-4
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2015, 01:28 AM
  3. [SOLVED] Script to Search for a specific String then return cell values above that String-3
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2015, 01:50 PM
  4. [SOLVED] Script to Search for a specific String then return cell values above that String-2
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 01:00 PM
  5. [SOLVED] Script to Search for a specific String then return cell values above that String
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 11:28 AM
  6. Search column for string and date then search adjacent cell and pop up message
    By ftwobtwo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2014, 09:55 AM
  7. [SOLVED] Vlookup, Match (Search or Find) partial string within string in a Cell
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2013, 12:40 PM

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