Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't sort with Excel 2007 | Excel Worksheet Functions | |||
Excel 2007 Query Wizard problem with Access 2007 extensions | Excel Discussion (Misc queries) | |||
sort function for dates does not sort properly in Office 2007 Exc. | Excel Worksheet Functions | |||
excel 2007 sort problem | Excel Worksheet Functions | |||
How to fix .sort in Excel 2007 | Excel Programming |