Hi
This is a bit of a continuation from the following post:
but as the subject of the post changed I thought I'd start a new thread.
The Problem
I need to find all instances of a value (e.g. "242") in column U.
I can do this with the following code but it picks up not only "242" but also "x242", "242x" and "x242x".
How can I ensure that it only selects exact matches for "242"???
This is a bit of a continuation from the following post:
HTML:
http://www.mrexcel.com/forum/showthread.php?p=1880080&posted=1#post1880080
but as the subject of the post changed I thought I'd start a new thread.
The Problem
I need to find all instances of a value (e.g. "242") in column U.
I can do this with the following code but it picks up not only "242" but also "x242", "242x" and "x242x".
How can I ensure that it only selects exact matches for "242"???
Code:
For lCount = 1 To WorksheetFunction.countIf(Columns("U:U"), vFind)
'MsgBox vID
Set rFoundCell = sdWS.Columns("U:U").Find(What:=vID, After:=rFoundCell, LookIn _
:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection _
:=xlNext, MatchCase:=False, SearchFormat:=False)
'MsgBox rFoundCell.Address
With rFoundCell
'.Interior.Color = RGB(255, 45, 67)
sdWS.Activate
rFoundCell.EntireRow.Copy
iTemp = tempWS.Range("B36556").End(xlUp).Row + 1
tempWS.Activate
tempWS.Range("A" & iTemp).PasteSpecial Paste:=xlPasteValues
End With
Next lCount