Link to home
Start Free TrialLog in
Avatar of Karl_mark
Karl_mark

asked on

Find Merged Cells in Excel Range and Unmerge

Hi,
I have some code which does a lot of calculation and generates a matrix as an output. As part of this, each coordinate in the matrix will grow or shrink depending on the number of values within the coordinate (if that makes sense!). For example, The coordinate corresponding to 3C may contain 6 values each of which are held in a separate cell. This then means that anything in the C row will always have at least 6 cells.
That's the bit that I've got working. What I'm struggling with is tidying up the titles. For each row I need to place a title which will be merged down across the cells; so, to use the previous example, if the 3C coordinate values are held in the range "H12:H17" I want to have a title of "C - Solid Performer" which will be merged in the range "D12:D17".
As it happens, I've also got this to work and I can get the titles to merge correctly. However, here is the problem:
If I re-run my function and the number of values in the coordinates differs (which it almost certainly will for each analysis), then the merged titles do not work as the previous merged cells have not cleared. The question is:
1. How do I find merged cells in a range (bearing in mind the range itself will not be static on each running of the code;
2. How do I unmerge the cells when they are found?
ASKER CERTIFIED SOLUTION
Avatar of McOz
McOz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Karl_mark
Karl_mark

ASKER

Simple and effective. Thanks!