Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Merged Cells Arrrgh (Excel 2002/2003)

    Hi

    I have run into several problems using VBA trying to copy and paste merged cells. Just out of curiosity is it possible to do this, or is it a strict NO NO.

    Regards

    Braddy
    If you are a fool at forty, you will always be a fool

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Merged Cells Arrrgh (Excel 2002/2003)

    I would avoid merged cells for other reasons, but it is possible to copy and paste them in VBA.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Merged Cells Arrrgh (Excel 2002/2003)

    Hi Hans

    Could I be cheeky and for a couple of the other reasons, so I can tell people when they request this.
    Or alternativly could you give me a small sample of VBA to copy and past merged cells.

    Many Thanks

    Braddy
    If you are a fool at forty, you will always be a fool

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Merged Cells Arrrgh (Excel 2002/2003)

    1) It is impossible to select a range of cells in one column if there is a horizontally merged cell among them - the selection will automatically include more columns. Similar for selecting cellls in a row if there are vertically merged cells.
    2) Excel can't autofit the width of columns and the height of rows containing merged cells.
    3) Although it is possible to copy and paste merged cells in VBA - just try recording a macro - it does cause problems in many situations.

    If you want to create a title that spans several columns, enter the title in the leftmost column, then select the cell plus some cells to the right of it, and set horizontal alignment (in the Alignment tab of Format | Cells) to Center Across Selection. This is just a format, the underlying cells will still exist.

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Merged Cells Arrrgh (Excel 2002/2003)

    Hi Hans

    Thanks for the explanation, as you say best to steer clear of Merged cells.

    Regards

    Braddy
    If you are a fool at forty, you will always be a fool

Posting Permissions

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