Results 1 to 8 of 8

Excel VBA to search the string from 'A1' cell

Threaded View

  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.

    Sub findProductscity()
    Dim prodFound As Boolean
    Dim CityFound As Boolean
    Dim prodCell As Range
    
    With Sheets("Input").Cells
                    Do
                        Set prodCell = .Find(What:="*Product1*", LookIn:=xlValues)       ' NEED TO CORRECT THIS-Doesnt search A1 cell
                            If Not prodCell Is Nothing Then
                                prodFound = True
                                    If Right(Trim(prodCell), 4) = Left(Trim(Worksheets("Data").Cells(1, 1).Value), 4) Then CityFound = True
                             End If
                    Loop Until prodFound = True And CityFound = True
        End With
    End Sub
    Attached Files Attached Files
    Last edited by mchilapur; 08-02-2018 at 02:23 PM.

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