LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Problem sorting data

Hello,

I'm using Excel 2003 and am having trouble sorting data. Here is the code
that I am using:

Application.Worksheets("Sheet1").Select
Application.Worksheets("Sheet1").Range("A1:A8").Se lect
Selection.Sort Key1:=Range("A1"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Here is my error message:

The sort reference is not valid. Make sure that it's within the data you
want to sort, and the first Sort By box isn't the same or blank.

The code comes alomst entirely from a the Macro I recorded, which works.
Meaning, if I select this range manually, the data sorts without a hiccup.
But if I try and execute code genned by the same sort Macro, VBA throws an
error. The only lines that did not come from the Macro are the first line,
selecting the worksheet and the "Application.Worksheets("Sheet1")." I
appended in front of Range.

Here is the data I have in Sheet1, Column A, Rows 1-8:

89100400
93092800
93701200
170074488
319529926
390162282
494995008
597663764

Totally confused.

Any help would be greatly appreciated.

Thanks,

Scott
 
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
Data Sorting Problem Dado Excel Discussion (Misc queries) 2 August 29th 09 10:10 PM
problem sorting data clcnewtoaccess Excel Discussion (Misc queries) 5 February 9th 09 08:00 PM
Problem with Sorting Data reggiebu Excel Discussion (Misc queries) 2 June 9th 05 09:37 PM
data sorting problem Pong Excel Worksheet Functions 0 February 18th 05 05:45 PM
data sorting problem Pong Excel Worksheet Functions 0 February 18th 05 05:39 PM


All times are GMT +1. The time now is 06:21 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"