|
-
May 24th, 2005, 12:52 PM
#1
Thread Starter
Junior Member
VBA code for Excel: Sorting by multiple columns at once
Hi,
I am having trouble finding examples of code to where I can sort an excel spreadshet by multiple columns at one time.
The code I'm using for sorting one at a time is as follows:
excelApp.Worksheets("Temp").UsedRange.Sort excelApp.Range("A1"),xlAscending
What do I have to add to this to sort by column b as well?
An example of what I'm trying to do...Say there are 50 people divided in to 5 teams. Column A is their team Number and Column B is their last name. I want to sort them first by their Team Number then Second by their last name. This is really easy to do in excel using their sort tool, but I am generating a ton of reports through this code and it would be a pain to have to do this manually for each report.
Thanks for any help you can provide in advance.
DL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|