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

On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Sort bug on Excel 2007

I made a typo when copying the code is "End Sub".

"Francisco" wrote:

On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Sort bug on Excel 2007

The range in Key1 is not full qualified,
try this:
Sheets(1).Range(SortRange1).Sort _
Key1:=Sheets(1).Range(CellToSort), _
Order1:=xlAscending, Header:=xlYes

Helmut.

"Francisco" schrieb im Newsbeitrag
...
On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Sort bug on Excel 2007

Thanks, but it does not work.
I have sheet(1) as active sheet and it does work on Excel 2003, the problem
is Excel 2007.

"Helmut Meukel" wrote:

The range in Key1 is not full qualified,
try this:
Sheets(1).Range(SortRange1).Sort _
Key1:=Sheets(1).Range(CellToSort), _
Order1:=xlAscending, Header:=xlYes

Helmut.

"Francisco" schrieb im Newsbeitrag
...
On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Sort bug on Excel 2007

Your code, as posted originally, worked fine for me on my copy of XL2007. I
did not get any error when I tried it with headers in A1:G1, sample data in
A2:G10 and using this line to call your code...

SortSalary "C1", "A1:G10"

No errors were reported and the data sorted as expected.

--
Rick (MVP - Excel)



"Francisco" wrote in message
...
Thanks, but it does not work.
I have sheet(1) as active sheet and it does work on Excel 2003, the
problem
is Excel 2007.

"Helmut Meukel" wrote:

The range in Key1 is not full qualified,
try this:
Sheets(1).Range(SortRange1).Sort _
Key1:=Sheets(1).Range(CellToSort), _
Order1:=xlAscending, Header:=xlYes

Helmut.

"Francisco" schrieb im Newsbeitrag
...
On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Sort bug on Excel 2007

This is very very odd.
My built is 12.0.6214.1000

"Rick Rothstein" wrote:

Your code, as posted originally, worked fine for me on my copy of XL2007. I
did not get any error when I tried it with headers in A1:G1, sample data in
A2:G10 and using this line to call your code...

SortSalary "C1", "A1:G10"

No errors were reported and the data sorted as expected.

--
Rick (MVP - Excel)



"Francisco" wrote in message
...
Thanks, but it does not work.
I have sheet(1) as active sheet and it does work on Excel 2003, the
problem
is Excel 2007.

"Helmut Meukel" wrote:

The range in Key1 is not full qualified,
try this:
Sheets(1).Range(SortRange1).Sort _
Key1:=Sheets(1).Range(CellToSort), _
Order1:=xlAscending, Header:=xlYes

Helmut.

"Francisco" schrieb im Newsbeitrag
...
On Excel 2003 it works perfectly, on Excel 2007 I have error 1004 "sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?


.

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Sort bug on Excel 2007

My build is 12.0.6524.5003 and it is SP2.

--
Rick (MVP - Excel)



"Francisco" wrote in message
...
This is very very odd.
My built is 12.0.6214.1000

"Rick Rothstein" wrote:

Your code, as posted originally, worked fine for me on my copy of XL2007.
I
did not get any error when I tried it with headers in A1:G1, sample data
in
A2:G10 and using this line to call your code...

SortSalary "C1", "A1:G10"

No errors were reported and the data sorted as expected.

--
Rick (MVP - Excel)



"Francisco" wrote in message
...
Thanks, but it does not work.
I have sheet(1) as active sheet and it does work on Excel 2003, the
problem
is Excel 2007.

"Helmut Meukel" wrote:

The range in Key1 is not full qualified,
try this:
Sheets(1).Range(SortRange1).Sort _
Key1:=Sheets(1).Range(CellToSort), _
Order1:=xlAscending, Header:=xlYes

Helmut.

"Francisco" schrieb im
Newsbeitrag
...
On Excel 2003 it works perfectly, on Excel 2007 I have error 1004
"sort
method of range class failed".


Sub SortSalary(CellToSort As String, SortRange1 As String)
Sheets(1).Range(SortRange1).Sort Key1:=Range(CellToSort),
Order1:=xlAscending, Header:=xlYes
End if


Is it a bug on Excel 2007?


.

.

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
Repeat Sort in Excel 2007 Kevin K[_2_] Excel Worksheet Functions 4 May 18th 10 12:23 PM
Can't sort with Excel 2007 caherpeak Excel Worksheet Functions 0 April 21st 09 10:01 PM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
How to fix/upgrade .sort in Excel 2007 [email protected] Excel Programming 1 May 15th 07 04:06 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:58 PM.

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"