I want to sort a particular column in my sheet which has my test case IDs, My current sort sub (given below) is sorting it like
1.1.1
1.1.12
1.1.15
1.1.2
1.1.22
1.1.3
is it because it is taking it as alphanumeric data?
how to get it to sort properly like?
1.1.1
1.1.2
1.1.3
1.1.12
1.1.15
1.1.22
My sub function:
Function sortSheet(ByVal sheet As Excel.Worksheet)
Dim oneRange As Range
Dim aCell As Range
Dim lastRow As Long, lastCol As Integer
'Calculating the last row and column
lastRow = sheet.Cells(Rows.Count, 1).End(xlUp).row
lastCol = sheet.Cells(1, Columns.Count).End(xlToLeft).Column
'Setting the range in which sorting is to be done
Set oneRange = sheet.Range(sheet.Cells(2, 1), sheet.Cells(lastRow, lastCol))
'Setting the range according to which it will be sorted
Set aCell = sheet.Range("A2")
'Sorting
oneRange.Sort Key1:=aCell, Order1:=xlAscending, Header:=xlGuess
End Function

Header:=xlYesor aHeader:=xlNooption. It's probably not a good idea to let Excel guess since you should know if your data has a header or not.1and1.1part of the complete series of the mutli-level list? What is the maximum number of 'pieces'?