View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Referencing Merged Cells in VBA

Never use Merged cells Is all I can say, only trouble.

Use Center across selection instead

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Ron Rosenfeld" wrote in message ...
I am in a situation where I am having to reference merged cells in VBA. The
source of the data is not something I would have any control over or input
into.

This is a code sample I am using:

r1.Offset(0, 1).Value * r1.Offset(0, 2).MergeArea(1, 1).Value

r1.offset(0,1) is not a merged cell but r1.offset(0,2) should usually be a
merged cell. I suppose it might not be on occasion, but that is not the case
yet.

Any caveats or other suggestions would be appreciated.

In my limited testing, .MergeArea(1,1) returns the data, whether or not the
cell is a merged cell.

Thanks.



--ron