Moderatori: Anthony47, Flash30005
Function FanSost(ByRef TitVoti As Range, ByRef TitRuol As Range, ByRef ReplVoti As Range, ByRef ReplRuol As Range, ByVal NSost As Long, ByVal valPort As Boolean) As Variant
Dim I As Long, J As Long, TotRep As Long, myRes()
'
ReDim myRes(1 To ReplVoti.Count)
ReDim myScr(1 To TitVoti.Count)
myScr = TitRuol.Value
'
For I = 1 To ReplVoti.Count
If ReplVoti.Cells(I, 1) <> "-" And ReplVoti.Cells(I, 1) <> " " And ReplVoti.Cells(I, 1) > 0 Then
If TotRep < NSost Then
For J = 1 To TitVoti.Count
If UCase(myScr(J, 1)) = UCase(ReplRuol.Cells(I, 1)) And (Not IsNumeric(TitVoti.Cells(J, 1)) Or TitVoti.Cells(J, 1) = 0) Then
myRes(I) = ReplVoti.Cells(I, 1).Value
myScr(J, 1) = ""
If UCase(TitRuol.Cells(I, 1)) <> "P" Or valPort = True Then TotRep = TotRep + 1
If TotRep >= NSost Then GoTo Esci Else Exit For
End If
Next J
End If
End If
Next I
Esci:
If Parent.Caller.Rows.Count > 1 Then myRes = Application.WorksheetFunction.Transpose(myRes)
FanSost = myRes
End Function
=FanSost(AA;BB;CC;DD;NN;1/0)
Sub ordinapert()
'
' ordinapert Macro
'
' Scelta rapida da tastiera: CTRL+o
'
Range("A3:C28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("A4:A28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("A3:C28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("H3:J28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("H4:H28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("H3:J28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("O3:Q28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("O4:O28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("O3:Q28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("V3:X28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("V4:V28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("V3:X28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("AC3:AE28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("AC4:AC28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("AC3:AE28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("AJ3:AL28").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("AJ4:AJ28"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("AJ3:AL28")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A34:C59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("A35:A59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("A34:C59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("H34:J59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("H35:H59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("H34:J59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("O34:Q59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("O35:O59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("O34:Q59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("V34:X59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("V35:V59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("V34:X59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("AC34:AE59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("AC35:AC59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("AC34:AE59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("AJ34:AL59").Select
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("1^").Sort.SortFields.Add Key:=Range("AJ35:AJ59"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="T", DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("1^").Sort
.SetRange Range("AJ34:AL59")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A3").Select
End Sub
Torna a Applicazioni Office Windows
Modidica Formula Somma I Riferimenti Autore: Francesco6918 |
Forum: Applicazioni Office Windows Risposte: 2 |
Excel: formula automatica per evidenziare prodotto scaduto Autore: gamma_ray |
Forum: Applicazioni Office Windows Risposte: 3 |
formula excel non visualizza risultato Autore: tommasog |
Forum: Applicazioni Office Windows Risposte: 6 |
Formula per proporzionare un numero Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Visitano il forum: Nessuno e 76 ospiti