PDA

View Full Version : Search whole row for



Pamella
08-02-2019, 10:56 PM
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?

mana
08-02-2019, 11:09 PM
Dim m

m = Application.Match("TESTING", wsSource.Rows(lngMyRow), 0)
If IsNumeric(m) Then

Pamella
08-02-2019, 11:17 PM
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

mana
08-02-2019, 11:35 PM
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

Pamella
08-02-2019, 11:43 PM
its seems to be selecting 3 cells in the next row not current row

mana
08-03-2019, 12:34 AM
why do you think so?

Pamella
08-03-2019, 04:02 AM
Sorry my mistake. It works thanks!