sort issue?

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
i have this code for sorting, however it gives me an error

"This operation requires the merged cells to be of identical size"

this error is due to few merged cells on my sheethow can i avoide this error as i need this merged cells.

Selection.Sort Key1:=Range("B1"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Please help
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
The sorts of options that come to mind are

- Get rid of the merged cells and see if 'Center Across Selection' would do just as well.

- Merge all the (groups of) cells in the sort range so they are all identically sized.

- Unmerge, sort, re-merge.

If you cannot make something of that, then you may need to provide more detail about just what you have on your sheet, where it is, which cells are merged and why you *need* the merged cells.
 
Upvote 0
How can i do unmerg and re-merge as i have merged no of blocks of cells.
I don't know if that will be applicable to your circumstances since I don't know what your circumstances are.

As I indicated in my previous post, if you couldn't make something of my suggestion yourself, you would have to provide certain additional details.
 
Upvote 0
- Unmerge, sort, re-merge.

I think your above suggestion would work where in i can unmerge all the cells in a work sheet then sort and re-merge the cells as before.

as my sort code is as below

Code:
Selection.Sort Key1:=Range("B1"), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
how can i do un merge and re merge
 
Upvote 0
I'm sorry, but I'm afraid that since you seem unprepared to provide the detail I asked for, I am unable to provide the detail of any code.

The only other thing I can suggest is to use the macro recoder to unmerge your cells, sort, and re merge the relevant cells and see if you can work with that code.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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