The key is to store them all as text (even "1" and "1.1"), and ensure that WBS elements have sufficient digits at each level. For example, if the second level can have over nine elements, you need two digits to preserve natural sort order: 1.01, 1.02, ..., 1.09, 1.10, 1.11 ...
If the WBS numbers already exist and can't be modified, then you can use this function to generate a sort key in another column:
Function WBSSortKey(v As Variant) As String
Dim s() As String, i As Integer
s = Split(v, ".")
WBSSortKey = Format(s(0), "000|")
For i = 1 To UBound(s)
If i > 0 And CInt(s(i)) > 99 Then
WBSSortKey = "#VALUE!"
Exit Function
Else
WBSSortKey = WBSSortKey & Format(s(i), "00")
End If
Next
End Function
Bookmarks