Setting Column Widths with MergedCells Or MergedSelection on Sheet

M

MaxGruven

When I have Merged Cells or MergedSelections on my sheet, I can NOT set
column widths on the rows below the header rows which have merged Cells.

However, I need to display a couple of headers that span all the filled in
columns in the rows below, so I really need Merged Cells (or MergedSelection)
(or a work around? Maybe there is something other then Merged??)

Is there a trick to getting column widths set on rows below header rows when
there are MergedCells in the header rows?

TIA,
George
 
J

Jialiang Ge [MSFT]

Hello George,

Would you send a screenshot of the initial and result state of the cells to
me? Knowing the input and the expected output will give me a clearer
picture of your question. Thanks. My email address is: (e-mail address removed).

Before I get your email, you may want to try these solutions first:

Suppose that A1:C1 is merged as a header row, we can get the merged area
with the property "MergeArea"
http://msdn.microsoft.com/en-us/library/aa612974(office.10).aspx
Range("A1:A1").MergeArea

If we set a value to the MergeArea.ColumnWidth property, e.g.
Range("A1:A1").MergeArea.ColumnWidth = 10, Excel will set 10 to each
column's width: Range("A1:A1").ColumnWidth = 10, Range("B1:B1").ColumnWidth
= 10, Range("C1:C1").ColumnWidth = 10. In other words, the final width of
the merged area is 10 * 3 = 30.

To set the column width of the cells below the header row, e.g.
Range("A2:A2"), we can do it in this way:
Range("A2:A2").ColumnWidth = 20
This setting with expand the merged area in the header row to be 20 + 10 +
10 = 40.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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