98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Sorting data
Sorting data
Resolved · High Priority · Version 2007
Mimi has attended:
Excel VBA Intro Intermediate course
Sorting data
Hi,
I am trying to sort some data within my worksheet.
There are headings in rows 1, columns A to J.
I would like to sort data in ascending order for (in ascending order): column C then
column D.
My code is below:
Selection.CurrentRegion.Select
Selection.sort key3:=Range("c1"), order3:=xlAscending, key4:=Range("d1"), order4:=xlAscending, Header:=xlGuess, ordercustom:=1
When I run this I get an error: run time error '1004'.
"Application-defined or object-defined run time error"
Thanks for any advice!
Mimi
RE: sorting data
Hi Mimi
Thanks for your question
If you replace Key 3 and 4 with key 1 and 2 then it seems to work fine. You can only sort by up to three keys. You also need to rename 0rder 3 and 4 order 1 and 2 as well
Regards
Stephen
Mon 26 Jul 2010: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:How to Spell Check an Excel 2010 WorksheetExcel 2010 does not automatically spell check a document. So, here's how to manually spell check a worksheet. |