ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how can I use a function to find out if an individual cell is par. (https://www.excelbanter.com/excel-worksheet-functions/9154-how-can-i-use-function-find-out-if-individual-cell-par.html)

nick.pattison

how can I use a function to find out if an individual cell is par.
 
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

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


"nick.pattison" wrote in message
...
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




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 ------------------

-----Original Message-----
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
.


nick.pattison

thanks very much... I have adapted it a little and it seems to work nicely

"Bernd Plumhoff" wrote:

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 ------------------

-----Original Message-----
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
.




All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com