ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test for Merge (https://www.excelbanter.com/excel-programming/348480-test-merge.html)

Gary''s Student

Test for Merge
 
What is the easiest way to code a Boolean UDF that, given a range as input,
will return TRUE if any cell in that range is merged and FALSE otherwise?
--
Gary's Student

Toppers

Test for Merge
 
Hi,

Try this:

=isMerge(A1:H1) in required cell

Function IsMerge(inRng)
For Each cell In inRng
If cell.MergeCells Then
IsMerge = True
Exit Function
End If
Next cell
IsMerge = False
End Function

"Gary''s Student" wrote:

What is the easiest way to code a Boolean UDF that, given a range as input,
will return TRUE if any cell in that range is merged and FALSE otherwise?
--
Gary's Student


Gary''s Student

Test for Merge
 
Thanks a lot. I now have a better test for "sortability"
--
Gary's Student


"Toppers" wrote:

Hi,

Try this:

=isMerge(A1:H1) in required cell

Function IsMerge(inRng)
For Each cell In inRng
If cell.MergeCells Then
IsMerge = True
Exit Function
End If
Next cell
IsMerge = False
End Function

"Gary''s Student" wrote:

What is the easiest way to code a Boolean UDF that, given a range as input,
will return TRUE if any cell in that range is merged and FALSE otherwise?
--
Gary's Student



All times are GMT +1. The time now is 05:17 PM.

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