+ Reply to Thread
Results 1 to 8 of 8

Merged Cells and Column Width

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Merged Cells and Column Width

    I have a survey form that I am creating in excel. Some columns have rows that are merged with other columns. I want to adjust the column width of one column without having all the others adjusted also because of the merging of cells. Is there a way to do that without unmerging all the cells?

    Thank you.
    Last edited by schmidt1962; 11-24-2013 at 02:11 PM.

  2. #2
    Forum Contributor
    Join Date
    06-24-2006
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    127

    Re: Merged Cells and Column Width

    Can you post an example workbook?

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Merged Cells and Column Width

    This would adjust the width of column D regardless if it had merged cells.

    Columns("D").ColumnWidth = 30
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Merged Cells and Column Width

    Even when I use the macro writer which selects the specific column width, then take that code and paste it in my main macro, all columns seems to be adjusted exactly to what I selected for that one individual column. I will try to recreate the problem and post a new workbook. Thank you!

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Merged Cells and Column Width

    Hi

    I created a workbook

    C2 and D2 are merged

    D3 downwards and c3 downwards are data.

    This code snippet sets the width of columns C ad D using the cells from C3 and D3 downwards.

    However if the text is larger than the sum of C3 and D3 then those columns are made wider to match C/D 3.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Merged Cells and Column Width

    I have attached a workbook I created. I merge 3 separate rows differently, then try to change the column width of 2 columns. What happens when I run the macro is that the last column width chosen ends up changing all columns that were part of the largest merged cells selection. Thanks for your thoughts and help!
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Merged Cells and Column Width

    Don't select the columns. Just change the column width without selection.

    Change this...
    Please Login or Register  to view this content.
    To this...
    Please Login or Register  to view this content.
    When you select a column, it selects their merged cells as well. So if you then change the width of the selection, all the columns selected (merged cells included) will be affected.

  8. #8
    Registered User
    Join Date
    05-08-2013
    Location
    Monterey, California
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: Merged Cells and Column Width

    THANK YOU THANK YOU! I thought that was the case,but wasn't sure how to write it. Really appreciate your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] column width macro in merged cell seems to have problem
    By anand_erin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 08:29 AM
  2. Replies: 8
    Last Post: 08-06-2009, 09:02 AM
  3. Replies: 3
    Last Post: 08-17-2006, 09:30 AM
  4. width of Merged cells within un merged cells
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 06:05 AM
  5. [SOLVED] Merged cells width
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2005, 05:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1