Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Problems with sort

I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
..Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Problems with sort

Right click the range and FormatCells--Alignment. Under 'Text Control' check
the status of 'MergeCells'
--
If this post helps click Yes
---------------
Jacob Skaria


"bigjim" wrote:

I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
.Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Problems with sort

You are telling Excel to sort the entire sheet in this portion of the code...
Sheets("MarginAnalysis").Cells

The "Key1:=.Range("b225:B270")" portion specifies the column to sort by.

Change .Cells to .Selection if you want to sort the selection.
However, the selection must intersect with column B.
--
Jim Cone
Portland, Oregon USA



"bigjim"

wrote in message
I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
..Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Problems with sort

The merged cells box is empty

"Jacob Skaria" wrote:

Right click the range and FormatCells--Alignment. Under 'Text Control' check
the status of 'MergeCells'
--
If this post helps click Yes
---------------
Jacob Skaria


"bigjim" wrote:

I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
.Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Problems with sort

OK, I tried this code:

With ActiveWorkbook.Sheets("MarginAnalysis").Range("b22 5:b270").Select
Selection.Sort Key1:=Range("b225"), Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End With

Now I'm getting this error:
"Sort reference is not valid. Make sure it's witing the data ou want to
sort and the first sort by box isn't the same or blank.

I'm not sure what that is saying.

Jim

"Jim Cone" wrote:

You are telling Excel to sort the entire sheet in this portion of the code...
Sheets("MarginAnalysis").Cells

The "Key1:=.Range("b225:B270")" portion specifies the column to sort by.

Change .Cells to .Selection if you want to sort the selection.
However, the selection must intersect with column B.
--
Jim Cone
Portland, Oregon USA



"bigjim"

wrote in message
I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
..Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Problems with sort

Ctrl+A and check whether there are any merge cells...and try the below code.

ActiveWorkbook.Sheets("MarginAnalysis").Range("b25 :b70"). _
Sort Key1:=Range("b25"), Order1:=xlDescending


If this post helps click Yes
---------------
Jacob Skaria


"bigjim" wrote:

The merged cells box is empty

"Jacob Skaria" wrote:

Right click the range and FormatCells--Alignment. Under 'Text Control' check
the status of 'MergeCells'
--
If this post helps click Yes
---------------
Jacob Skaria


"bigjim" wrote:

I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
.Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Problems with sort

this worked for me.

With ActiveWorkbook.Sheets("MarginAnalysis")
.Range("b225:b270").Sort Key1:=.Range("b225"), _
Order1:=xlDescending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End With
--
jb


"bigjim" wrote:

OK, I tried this code:

With ActiveWorkbook.Sheets("MarginAnalysis").Range("b22 5:b270").Select
Selection.Sort Key1:=Range("b225"), Order1:=xlDescending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End With

Now I'm getting this error:
"Sort reference is not valid. Make sure it's witing the data ou want to
sort and the first sort by box isn't the same or blank.

I'm not sure what that is saying.

Jim

"Jim Cone" wrote:

You are telling Excel to sort the entire sheet in this portion of the code...
Sheets("MarginAnalysis").Cells

The "Key1:=.Range("b225:B270")" portion specifies the column to sort by.

Change .Cells to .Selection if you want to sort the selection.
However, the selection must intersect with column B.
--
Jim Cone
Portland, Oregon USA



"bigjim"

wrote in message
I'm using excel 2003. I want to sort data formatted as text in a column.
Most of the cells in the column are blank. I am using the following code:

With Sheets("MarginAnalysis")
..Cells.Sort Key1:=.Range("b225:B270"), _
Order1:=xlAscending, Header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End With

The error I get is "This operation requires the merged cells to be
identically sized. " There are no merged cells anywhere in the range
selected. When I go to the worksheet "marginanalysis" after the program
stops the range b225:b282 is highlighted.??
I'm lost and any help would be appreciated.

Jim

Reply
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
Sort by column problems OfficeNDN Excel Worksheet Functions 2 August 31st 06 08:53 AM
Sort problems Ken MacDonald Excel Discussion (Misc queries) 5 January 15th 06 03:02 PM
Custom Sort Problems Ken McLennan[_3_] Excel Programming 2 September 19th 05 10:32 AM
Excel Sort Problems Bumfuzzled Excel Programming 1 August 25th 05 07:57 AM
Date sort problems Graham_Wright Excel Discussion (Misc queries) 2 January 4th 05 05:00 PM


All times are GMT +1. The time now is 09:35 AM.

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

About Us

"It's about Microsoft Excel"