I have a macro that searches for numbers in another sheet and then copies the row it finds it in to sheet 1.
the problem is that some of the search criteria is alpha numeric. i.e 227A, JD190T, etc.
code
Sub copyit()
Dim wsSearch As Worksheet, wsResult As Worksheet
Dim Found As Range, rngWhat As Range
Set wsSearch = Sheets("Compiler")
Set wsResult = Sheets("Sheet1")
Set rngWhat = wsResult.Range("A1")
If Not IsEmpty(rngWhat) Then
Set Found = wsSearch.Range("A:A").Find(What:=rngWhat.Value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Found Is Nothing Then
Found.EntireRow.Copy Destination:=wsResult.Range("A5")
Else
MsgBox "No match found for " & rngWhat.Value, , "No Match"
End If
End If
End Sub
code
i have the searchable row in sheet "compiler" set to General formatting.
i'm also having the same problem using Vlookup for the same thing in a list.
=VLOOKUP(A10,Compiler!$A$1:$AP$6359,5,FALSE)
it finds the numeric value's but returns N/A for anything with a letter in it.
i've been searching and tryign different things for a few days with no luck.
Thanks!
the problem is that some of the search criteria is alpha numeric. i.e 227A, JD190T, etc.
code
Sub copyit()
Dim wsSearch As Worksheet, wsResult As Worksheet
Dim Found As Range, rngWhat As Range
Set wsSearch = Sheets("Compiler")
Set wsResult = Sheets("Sheet1")
Set rngWhat = wsResult.Range("A1")
If Not IsEmpty(rngWhat) Then
Set Found = wsSearch.Range("A:A").Find(What:=rngWhat.Value, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Found Is Nothing Then
Found.EntireRow.Copy Destination:=wsResult.Range("A5")
Else
MsgBox "No match found for " & rngWhat.Value, , "No Match"
End If
End If
End Sub
code
i have the searchable row in sheet "compiler" set to General formatting.
i'm also having the same problem using Vlookup for the same thing in a list.
=VLOOKUP(A10,Compiler!$A$1:$AP$6359,5,FALSE)
it finds the numeric value's but returns N/A for anything with a letter in it.
i've been searching and tryign different things for a few days with no luck.
Thanks!