Sorting Excel data from a .VBS script?

G

gordonmytuba

How do I sort data in an Excel worksheet from a .vbs script file?

Or can I programmatically create a macro into the .xls file I create from
the .vbs file and then have it run when I load the sheet from the script?

Here's the macro of sorting the data:
Sub SortData()
Range("A1:N20").Select
Range("N20").Activate
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

Thanks for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top