Consulting

Results 1 to 7 of 7

Thread: Search whole row for

  1. #1
    VBAX Regular
    Joined
    Jul 2019
    Posts
    36
    Location

    Search whole row for

    Dim lngMyRow as long

     If InStr(StrConv(wsSource.Cells(lngMyRow), vbUpperCase), "TESTING") > 0 Then
    This is not searching the whole row. Can someone please help?

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Dim m
    
    m = Application.Match("TESTING", wsSource.Rows(lngMyRow), 0)
    If IsNumeric(m) Then

  3. #3
    VBAX Regular
    Joined
    Jul 2019
    Posts
    36
    Location
    Thanks mana. Can we change it not to be exact match. Sometimes it could be TESTINGS. Then once its found match go to last populated cells in the same row and copy values of three cells . ie. if last populated cell in the same row is in P. Then copy value from cells N O and P

  4. #4
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Dim r As Range
    
    
    Set r = wsSource.Rows(lngMyRow).Find("testing", , xlValues, xlPart, , xlPrevious, False)
    If Not r Is Nothing Then
        MsgBox r.Resize(, 3).Address
    End If

  5. #5
    VBAX Regular
    Joined
    Jul 2019
    Posts
    36
    Location
    its seems to be selecting 3 cells in the next row not current row

  6. #6
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    why do you think so?



  7. #7
    VBAX Regular
    Joined
    Jul 2019
    Posts
    36
    Location
    Sorry my mistake. It works thanks!

Tags for this Thread

Posting Permissions

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