hello guys..
I have a problem in sorting the excel data in VB..This is example of the data:
PAP03-101-108-01-00-00-00-0000
PAP03-101-108-02-00-00-00-0000
PAP04-101-108-01-01-00-00-0000
PAP04-101-108-02-01-00-00-0000
PAP04-101-108-01-02-00-00-0000
When i try to sort the data, the result is:
PAP03-101-108-01-00-00-00-0000
PAP03-101-108-02-00-00-00-0000
PAP04-101-108-01-01-00-00-0000
PAP04-101-108-01-02-00-00-0000
PAP04-101-108-02-01-00-00-0000
Actually, Im trying to sort it to be in this way :
PAP03-101-108-01-00-00-00-0000
PAP04-101-108-01-01-00-00-0000
PAP04-101-108-01-02-00-00-0000
PAP03-101-108-02-00-00-00-0000
PAP04-101-108-02-01-00-00-0000
I donno how to do it.. I try to use macro code, but nothing happened.
VB Code:
Dim tmp1, tmp2 As String tmp1 = "B2" tmp2 = "D" & n objExcel.Range("tmp1:tmp2").Select objExcel.Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("D2") _ , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom
help me guyz!




Reply With Quote