Advanced Find
Advanced Find
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Advanced Find

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Singapore
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    The find object(what:=) is the contents of two cells? how to perform this?
    eg.
    in Range("A1:Y50"), i want to find two horizontally consecutive cells that have values "value1" and "value2" respectively.

    regards
    Andrew XJ

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Andrew

    Try

    Sub FindThem()
    Dim Rfound As Range
    Dim iLoop As Integer

    Set Rfound = Range("A1")
    For iLoop = 1 To WorksheetFunction.CountIf(Range("A1:Y50"), "Value1")
    Set Rfound = Range("A1:Y50").Find(What:="Value1", After:=Rfound, LookIn:=xlValues, LookAt:= _
    xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
    If Rfound.Offset(0, 1) = "Value2" Then
    Rfound.Range("A1:B1").Select
    Exit For
    End If
    Next iLoop
    End Sub


  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Singapore
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thank you very much, Dave!!
    I am always trying to find some stuff in the embedded VBA to solve my problem. Learning from you. I think for most problem we can use UDF to solve it.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com