sort error

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
Hi I get an error while doing a sort

"This operation requires the merged cells to be identically sized"

Code:
Range(c8).select
Range(Cells(1, 1), Cells.SpecialCells(xlCellTypeLastCell)).Sort Selection, xlDescending

Please help
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi there,

It's because somewhere in your data you have a merged cell and it can't work out where the cell belongs.

Could you tell me what the range of data is that you want to sort (i.e. A1:A500) and where your merged cell is.

Ideally you should never use merged cells when trying to use VBA, as you can't directly reference them. Merged cells are the devil!
 
Upvote 0
You can't sort a column that contains merged cells.
Best method is to find the merged cells and unmerge them and replace it with...
Select the cells that were merged and then Format / cells/ alignment
Select the horizontal dropdown box and pick "center across selection"
Then try the sort again.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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