View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matilda Matilda is offline
external usenet poster
 
Posts: 57
Default Find a string match in a column

aaaaahhhhhh !!!! Thanks Bob, and Jim. Variant type ... sorted!



"Bob Phillips" wrote:

Try using

res = Application.Match(myVar, MyRng,0)


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Matilda" wrote in message
...
Hi,

I am wanting to find a string from a column which matches my variable. I
modified this code of Tom Ogilvy's in a related answer

For Each cell In rngA
res = Application.Match("*" & cell.Value & "*", rngB, 0)
If Not IsError(res) Then
Set rng = rngB(res)
rng.Offset(0, 1).Value = cell
End If

to

For Each cell In rngA
res = Application.Match(myVar, MyRng)
If Not IsError(res) Then
myCode
End If
next

but I get a number in res that in fact is a blank cell. Can't work out

what
is happening. Any help appreciated.