Thread: sort method
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default sort method

You have a syntax error

With Sheets("Sheet1").Range("A1:B23")
.Sort key1:= Sheets("Sheet1").Range("B1")
End With

--
Regards,
Tom Ogilvy


"benb" wrote in message
...
I'm having trouble with the sort method, but no clue as to why. Here is

my
code:

With Sheets("Sheet1").Range("A1:B23")
.Sort key1 = Sheets("Sheet1").Range("B1")
End With

I've also tried just Sheets("Sheet1").Range("A1:B23").Sort but I'm
continually getting a Sort Method of Range Class Failed error. I just

want
to sort the range I am going to use to populate a listbox. If I select

the
range then sort the selection it seems to work, but I didn't think I had

to
select a range to be able to use the sort method. Any help?