-
Sorting a subtotaled spreadsheet programmatically
I have created a spreadsheet using VB, populated it with a few thousand rows and subtotaled it using the Range().Subtotal method.
So far so good!
I now need to sort the rows by the subtotal value in the subtotal column. I know it's possible because I can do this 'manually' on the spreadsheet simply by clicking on the column head and hey-presto the groups are sorted, not the individual rows.
I have tried the following code:
Range(groupStartCell).Sort(Key1:=worksheet.Range("F2" & lastRow.ToString), Order1:=Interop.Excel.XlSortOrder.xlDescending, Orientation:=Interop.Excel.XlSortOrientation.xlSortRows, Header:=Interop.Excel.XlYesNoGuess.xlGuess, OrderCustom:=1, MatchCase:=False)
and it does nothing!
-
Try recording a macro, then do it manually, then stop the recording.
The resulting code should be what you need.
-
Thank you Hack, I'll try that.
Similar Threads
-
By anonymous in forum VB Classic
Replies: 1
Last Post: 04-23-2004, 11:49 PM
-
By Willy Van den Driessche in forum VB Classic
Replies: 11
Last Post: 04-11-2002, 04:31 PM
-
Replies: 2
Last Post: 09-28-2001, 11:04 AM
-
By Dale Boyer in forum VB Classic
Replies: 6
Last Post: 01-29-2001, 12:57 PM
-
By Dale Boyer in forum VB Classic
Replies: 0
Last Post: 01-26-2001, 02:22 PM
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|