Sort excel sheet from VB-5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chilidogie
    New Member
    • Mar 2012
    • 5

    Sort excel sheet from VB-5

    Does anyone have the format to sort an excel sheet from VB ? I add data to an existing sheet using the object ACTIVECASE, etc... example: ACTIVECASE.CELL S(6,20)="Y". I update the F column (Payment received) thru VB. I understand there is a SORT where I can specify ACTIVECASE.SORT ... but I don't know the full speification for sort range, sort columns, nor accesding/descending, etc. I have a header row so I assume my range would be A2:G10000 using A1 as the first sort key (name), D1 (date) as the second key, and E1 (staff) as the third key.

    Currently in VB, I have command-1 where the user updates specific name/payments. This updates the ACTIVECASE excel sheet. I then go into excel, sort the sheet by name/date/staff member, then go back into my VB form and do command-3 that figures the payments, etc. It would be nice if I could have command-2 button that sorts the excel sheet without having to exit VB

    Thanx

    Thanx !!
  • chilidogie
    New Member
    • Mar 2012
    • 5

    #2
    Found it on another site. Thanx anyway. It is actually very easy...

    activecase.rang e("A2:Z5000").S ort key1:=activecas e.range("a2"), key2:=activecas e.range("d2"), key3:=activecas e.range("e2")

    Comment

    Working...