View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default problem with find in merged cells

I'd bet that .find is supposed to work with merged cells. And that it's a bug
that it fails.

Another reason not to use merged cells?????

Antonio wrote:

I thought I had this VBA pretty under control, but this one is new to me.

set r = .Find(" - Open Positions ( August 03, 2007 )")

returns nothing even though there is cell with that value

The only peculiarity of that cell is that is merged with others

Is the find function not supposed to work for merged cells?

Thanks,

Antonio

Code and sheet follows:

Sub main()

Dim r As Range

Dim match_address As String

Dim st As String

st = Worksheets(1).Range("A3").Value

With Worksheets(1).Columns("A")

Set r = .Find(st)

If Not r Is Nothing Then

match_address = r.Address

End If

End With

End Sub

Sheet:

Average Credit Balance 51,608.69 51,608.69 0

- Open Positions ( August 03, 2007 )
Stocks
Symbol Open Quantity Mult Open Price Close Price Cost Basis Value Unrealized
P/L
EUR
CS -- 7,000 1 -- -- 28.25 197,750.00 --
EAD -- 8,000 1 -- -- 21.92 175,360.00 --
FPB -- 5,000 1 -- -- 54.71 273,550.00 --


--

Dave Peterson