match function code?
Tom - this is perfect.
Is there a way to automatically go to A2 and perform the same routine, then
A3, etc?
TIA.
Jay
"Tom Ogilvy" wrote in message
...
this worked fine with a result string longer than 255 characters.
Sub FindString()
Dim sStr As String, sStr1 As String
Dim rng As Range
Dim fAddr As String
sStr = Range("A1")
sStr1 = ""
Set rng = Columns(3).Find(What:=sStr, _
After:=Range("C65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
sStr1 = sStr1 & rng.Row & ", "
Set rng = Columns(3).FindNext(rng)
Loop While rng.Address < fAddr
End If
sStr1 = Left(sStr1, Len(sStr1) - 1)
Range("B1").Value = sStr1
End Sub
--
Regards,
Tom Ogilvy
"JayLo" wrote in message
...
This produces the following error code...
Run Time error 91
Object variable or With Block variable not set
Any ideas?
-----Original Message-----
Have not tried this with 255+ characters but otherwise
it works for me:
Sub FindA1()
Dim Rng As Range
Set Rng = Range("C:C").Find(What:=Range("A1"))
Range("B1") = Rng.Row
End Sub
"JayL" wrote:
All,
Looking for code to read contents of cell A1, search
column C for any cell
that contains A1 anywhere in a cell and return the row
number of any finds
in Column C to cell B1.
I used the match function and it works but has a 255
character cell
limitation, which I need to surpass.
TIA,
J
.
|