how can I use a function to find out if an individual cell is par.

N

nick.pattison

I need to be able to tell if a cell at a given cell reference is part of a
merged group of cells or not
 
B

Bernie Deitrick

Nick,

You need to use a User-Defined Function, code given below. Copy the code
into a code module, and use it like

=IsMerged(A1)

It will return TRUE if A1 is part of a merged cell, FALSE otherwise.

HTH,
Bernie
MS Excel MVP


Function IsMerged(inCell As Range) As Boolean
IsMerged = inCell.MergeCells
End Function
 
B

Bernd Plumhoff

Maybe this udf helps.

Regards,
Bernd

-------- snip here, press ALT + F11, insert module, put
code in ---------

Option Explicit

Public Function IsMerged(varRange As Variant, varCell As
Variant) As Boolean
'True if varCell belongs to merged cell range varRange,
'false if varRange not merged or varCell not part of
varRange

Dim ivarRange As Variant

IsMerged = False

For Each ivarRange In varRange

If ivarRange.MergeCells And ivarRange.Address =
varCell.Address Then

IsMerged = True
Exit Function

End If

Next ivarRange

End Function

--------- snip here ------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top