
Sub ordina_per_CATEGORIA_Personalizzato()
Range("A3:P2002").Select
Application.AddCustomList ListArray:=Array("1^ Squadra", "Juniores", "Allievi A", _
"Allievi B", "Giovanissimi A", "Giovanissimi B", "Esordienti A", "Esordienti B", _
"Pulcini 2° anno", "Pulcini 1° anno", "Primi Calci 2° anno", "Primi Calci 1° anno", _
"Piccoli Amici 2° anno", "Piccoli Amici 1° anno", "Preinserimento", "Prova", "All. Iscritto Albo", "All. Senza Q.", "Istr. Coni/Figc SC", "Dirig. Accomp.")
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
"E3:E2002"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"1^ Squadra,Juniores,Allievi A,Allievi B,Giovanissimi A,Giovanissimi B,Esordienti A,Esordienti B,Pulcini 2° anno,Pulcini 1° anno,Primi Calci 2° anno,Primi Calci 1° anno,Piccoli Amici 2° anno,Piccoli Amici 1° anno,Preinserimento, Prova, All. Iscritto Albo, All. Senza Q.,Istr. Coni/Figc SC, Dirig. Accomp." _
, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
"A3:A2002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
"D3:D2002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("__Tesserati__").Sort
.SetRange Range("A3:P2002")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E3").Select
End Sub
|
Sub OrdinamentoSelezionato()
ord1 = "$A$2"
ord2 = "$D$2"
ord3 = "$E$2"
If ActiveCell.Address <> ord1 And ActiveCell.Address <> ord2 And _
ActiveCell.Address <> ord3 Then Exit Sub
ur = Cells(Rows.Count, 1).End(xlUp).Row 'ultima cella piena col.A
If ActiveCell.Address = ord1 Then 'ordina per nominativo (segue anno e cat)
UNO = "A2:A" & ur
DUE = "D2:D" & ur
TRE = "E2:E" & ur
ElseIf ActiveCell.Address = ord2 Then 'ordina per anno (segue nominativo e cat)
UNO = "D2:D" & ur
DUE = "A2:A" & ur
TRE = "E2:E" & ur
ElseIf ActiveCell.Address = ord3 Then 'ordina per cat (segue nominativo e anno)
UNO = "E2:E" & ur
DUE = "A2:A" & ur
TRE = "D2:D" & ur
End If
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
UNO), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
DUE), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("__Tesserati__").Sort.SortFields.Add Key:=Range( _
TRE), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("__Tesserati__").Sort
.SetRange Range("A2:O" & ur)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
|
Application.AddCustomList ListArray:=Array("Cognome", "Nome", "Indirizzo", "Città", "P.iva", "telefono") 'usiamo una matrice scrivendo i componenti l'elenco |
