Solved

Find Merged Cells in Excel Range and Unmerge

Posted on 2011-03-14
2
794 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:Karl_mark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
McOz earned 500 total points
ID: 35130445
How about simply unmerging ALL cells before re-running the function?

 
Cells.Unmerge

Open in new window


Cheers
0
 

Author Closing Comment

by:Karl_mark
ID: 35259628
Simple and effective. Thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question