kweaver
Well-known Member
- Joined
- May 12, 2009
- Messages
- 2,934
- Office Version
- 365
- 2010
Without posting the confidential data and without creating a fake sample (which I might have to do tomorrow if no one can understand this)...
I'm trying to find the row in a column where the SearchedValue (which is an email address, if that matters), is found (or not) in column A of the OLD sheet.
Using the following section of code. If/When the email is found, another value from the 5th column of the "OLD" sheet is put into another sheet.
The code is finding about 90% of the emails and not all of them for some reason. There aren't any extra spaces in the SearchedValue nor the column A of OLD being searched.
Am I just ignoring something simple and obvious to someone? Hope you spot my error. Thanks in advance.
I'm trying to find the row in a column where the SearchedValue (which is an email address, if that matters), is found (or not) in column A of the OLD sheet.
Using the following section of code. If/When the email is found, another value from the 5th column of the "OLD" sheet is put into another sheet.
The code is finding about 90% of the emails and not all of them for some reason. There aren't any extra spaces in the SearchedValue nor the column A of OLD being searched.
Am I just ignoring something simple and obvious to someone? Hope you spot my error. Thanks in advance.
Code:
For j = 2 To lro
If StrComp(Sheets("OLD").Range("A" & j).Value, SearchedValue, vbTextCompare) = 0 Then
MatchingRow = j
Exit For
End If
Next j
Sheets("Adj").Cells(r, "E") = Sheets("OLD").Cells(j, 5)