2=2 Stati: ad ogni chiamata il triangolo cambia verso
3=3 Stati: il tringolo si alterna in Ascendente, Discendente, nulla
0=Sola lettura, la funziona restituisce il metodo di ordinamento senza cambiarlo
ENG: This funztion return Sorting Order Method. It has 3 working methods:
2=2 state mode: on every call triangle change order
3=2 state mode: trinagle alternate Ascending, Descending, None
0=Read only mode, function returns sort order without changes
' ' Aggiunge il simbolo ordinamento e restituisce il tipo di ordinamento da usare ' Add sort simbo on right side and return sort order ' ' smode: 2= Two State (Ascending, Descending) ' 3= Three State (Ascending, Descending, None) ' 0= Read Only Function SortSimbol(Target As Range, Optional iMode As Integer = 2) Dim l As Integer Dim c As String Dim i As Integer ' Len of Const kFontName = "Webdings" l = Len(Target.Value) c = Right$(Target, 1) Select Case iMode Case 2, 3 i = 1 Select Case c Case "6" c = "5" Case "5" If iMode = 3 Then c = "" Else c = "6" End If Case Else i = 0 c = "6" End Select ' Change State Target = Left$(Target, l - i) & c ' Apply Font If Len(c) = 1 Then l = Len(Target) Target.Characters(Start:=l, Length:=1).Font.Name = kFontName End If End Select ' Read actual status If Target.Characters(Start:=l, Length:=1).Font.Name = kFontName Then Select Case c Case "5" SortSimbol = xlDescending Case "6" SortSimbol = xlAscending Case Else SortSimbol = 0 End Select Else SortSimbol = 0 End If End Function