Results 1 to 5 of 5

Autofill and merged cells

This is a discussion on Autofill and merged cells within the Excel Questions forums, part of the Question Forums category; I'm trying to do an autofill and part of the source range for the autofill has some merged cells. I ...

  1. #1
    Board Regular
    Join Date
    Sep 2008
    Location
    Holberg, BC
    Posts
    56

    Default Autofill and merged cells

    I'm trying to do an autofill and part of the source range for the autofill has some merged cells.

    I keep getting the error:
    "This operation requires the merged cells to be identically sized."

    I made a brand new test sheet (didn't screw with column or row widths) and merged, A1 and B1 and placed the number 1 in it. I then merged C1 and D1. When I tried to do an autofill in VBA -

    sheets("Test").range("a1:b1").autofill destination:=sheets("Test").range("a1:d1"), Type:=xlfilldefault

    it gave me the same error message (see above).

    Can anyone tell me what this error message is referring to?

  2. #2
    Board Regular MrKowz's Avatar
    Join Date
    Jun 2008
    Location
    St. Louis, MO
    Posts
    6,109

    Default Re: Autofill and merged cells

    General rule of thumb... merged cells and VBA don't like each other. A great alternative to merging cells is to "Center Across Selection", because that doesn't mess with VBA coding at all.
    - Posting guidelines, forum rules and terms of use
    - Try searching for your answer first, see how
    - Read the FAQs
    - List of BB codes
    - Please use [CODE] [/CODE] tags when posting your VBA code. It retains spacing, so your code is easier to read, and therefore easier to debug.
    - Please back up your file before using any macros suggested!

  3. #3
    Board Regular
    Join Date
    Sep 2008
    Location
    Holberg, BC
    Posts
    56

    Default Re: Autofill and merged cells

    What do you mean by "Center Across Selection?" Can that be done in regular excel as well?

  4. #4
    Board Regular
    Join Date
    Sep 2008
    Location
    Holberg, BC
    Posts
    56

    Default Re: Autofill and merged cells

    p.s. thanks for the rule of thumb, I won't forget it.

  5. #5
    Board Regular
    Join Date
    Sep 2008
    Location
    Holberg, BC
    Posts
    56

    Default Re: Autofill and merged cells

    I found out what center accross selection was/does. I tried it and the macro I've been battling with the past few hours works perfectly.

    Thank you very much. I'd still be using the macro recorder exclusively if it wasn't for this forum and those that take the time to answer questions from beginers.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com