Autofill and merged cells

BHunter

Board Regular
Joined
Sep 16, 2008
Messages
60
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?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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.
 
Upvote 0
What do you mean by "Center Across Selection?" Can that be done in regular excel as well?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,185
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top