Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Sort problem in Excel 2007

Hi
I am testing macros that worked in Excel 2003 under Excel 2007.


In the program I use, rows from a list (across several cells) are
sometimes removed and I then use the sort line below to remove the blank
rows left in the list. This then produces the error message below.


'--- Do an alpha sort to remove blanked out lines
Shd.Range("B5:BB40").Sort Key1:=Shd.Range("B5"), Order1:=xlAscending


Error message:
"sort method of the range class failed error 1004"

Is there a simple way around this ?


Interesting:

1. After I 'End' the error message and get back to the page where the
blank rows are I can then sort the rows OK using a slightly different
sort routine (sorted numerically by total instead of alphabetically).


2. When re-running the code back under Excel 2003 I now get the same
error as first appeared in Excel 2007 !!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Sort problem in Excel 2007

On Mon, 26 Jan 2009 08:03:40 +0900, Andrew Bourke wrote:

Hi
I am testing macros that worked in Excel 2003 under Excel 2007.


In the program I use, rows from a list (across several cells) are
sometimes removed and I then use the sort line below to remove the blank
rows left in the list. This then produces the error message below.


'--- Do an alpha sort to remove blanked out lines
Shd.Range("B5:BB40").Sort Key1:=Shd.Range("B5"), Order1:=xlAscending


Error message:
"sort method of the range class failed error 1004"

Is there a simple way around this ?


Interesting:

1. After I 'End' the error message and get back to the page where the
blank rows are I can then sort the rows OK using a slightly different
sort routine (sorted numerically by total instead of alphabetically).


2. When re-running the code back under Excel 2003 I now get the same
error as first appeared in Excel 2007 !!


I wonder if one of the optional Sort method parameters are somehow getting set
in such a way as to mess things up. Try setting them explicitly and see what
happens.

There were some new sort parameters added in 2007.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Sort problem in Excel 2007


I've tried a workaround but all of a sudden it started working again -
WEIRD!

Thanks

On 26/01/2009 10:31 AM, Ron Rosenfeld wrote:
On Mon, 26 Jan 2009 08:03:40 +0900, Andrew wrote:

Hi
I am testing macros that worked in Excel 2003 under Excel 2007.


In the program I use, rows from a list (across several cells) are
sometimes removed and I then use the sort line below to remove the blank
rows left in the list. This then produces the error message below.


'--- Do an alpha sort to remove blanked out lines
Shd.Range("B5:BB40").Sort Key1:=Shd.Range("B5"), Order1:=xlAscending


Error message:
"sort method of the range class failed error 1004"

Is there a simple way around this ?


Interesting:

1. After I 'End' the error message and get back to the page where the
blank rows are I can then sort the rows OK using a slightly different
sort routine (sorted numerically by total instead of alphabetically).


2. When re-running the code back under Excel 2003 I now get the same
error as first appeared in Excel 2007 !!


I wonder if one of the optional Sort method parameters are somehow getting set
in such a way as to mess things up. Try setting them explicitly and see what
happens.

There were some new sort parameters added in 2007.
--ron


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Sort problem in Excel 2007

On Mon, 26 Jan 2009 20:23:34 +0900, Andrew Bourke wrote:

I've tried a workaround but all of a sudden it started working again -
WEIRD!


I've not tested the Sort method, but I know that with some methods, the
optional parameters, once set, stay at that setting until changed. So I still
wonder if that was the issue. If so, it could recur.
--ron
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
Can't sort with Excel 2007 caherpeak Excel Worksheet Functions 0 April 21st 09 10:01 PM
Excel 2007 Query Wizard problem with Access 2007 extensions Showdad Excel Discussion (Misc queries) 0 December 4th 08 05:57 PM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
excel 2007 sort problem cindy Excel Worksheet Functions 2 October 3rd 07 01:01 PM
How to fix .sort in Excel 2007 [email protected] Excel Programming 0 April 17th 07 09:13 PM


All times are GMT +1. The time now is 10:17 AM.

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"