LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default VBA Sort Problem

I have five different areas on a worksheet that I want to sort separately.
When it gets to the fourth section ("A43:f" & DMcnt), I get the following
error message:

"RunTime Error 1004
This operation requires the merged cells to be identically sized."

Not sure what I am doing wrong, any suggestions?

I use the following code for each group like this:

With Worksheets("CASB-Toronto Central Phone List").Range("a12:f" & AMcnt)
.Sort _
Key1:=.Columns(6), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Worksheets("CASB-Toronto Central Phone List").Range("a21:f" & BMcnt)
.Sort _
Key1:=.Columns(6), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Worksheets("CASB-Toronto Central Phone List").Range("a33:f" & CMcnt)
.Sort _
Key1:=.Columns(6), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Worksheets("CASB-Toronto Central Phone List").Range("a43:f" & DMcnt)
.Sort _
Key1:=.Columns(6), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Worksheets("CASB-Toronto Central Phone List").Range("a50:f" & EMcnt)
.Sort _
Key1:=.Columns(6), _
Order1:=xlAscending, _
Header:=xlNo
End With
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! I am having a problem with sort! RobertD[_2_] Excel Discussion (Misc queries) 2 August 29th 08 07:56 PM
Sort Problem Trish[_2_] Excel Discussion (Misc queries) 1 March 25th 08 11:51 AM
A "sort" problem comotoman Excel Discussion (Misc queries) 1 September 28th 05 10:48 PM
Sort Problem andyp161 Excel Worksheet Functions 1 September 5th 05 12:19 PM
Sort Problem jdb Excel Discussion (Misc queries) 1 January 10th 05 11:05 PM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"