Perdona ma continua ad essere sempre poco chiaro il tuo esposto
qui dici
freetime78 ha scritto:La macro deve trovarmi quel o quei numeri che sono "Sempre" presenti in tutti e 3 i blocchi
e poi dici
freetime78 ha scritto:e farmi un'elenco in ordine
dal piu' grande al piu' piccolo
Se sono sempre presenti avranno 3 (o 9 con 9 gruppi)
quindi non esiste un più grande o più piccolo
a meno che non ti riferisca ai numeri e non alle presenze
Comunque prova questa macro e lavoriamo su questa e sui risultati ottenuti rispetto a ciò che avresti intenzione di ottenere
- Codice: Seleziona tutto
Sub ContaP()
Worksheets("Presenze").Select
Columns("S:Z").ClearContents
UR = Range("A" & Rows.Count).End(xlUp).Row
Gr = Int(UR / 9)
Dim VN(90) As Integer
For Azz = 1 To 90
VN(Azz) = 0
Cells(Azz, 19).Value = Azz
Next Azz
Range("Z1").Value = "Num Sempre Presenti"
For N = 1 To 90
For RR = 1 To UR - 8 Step Gr
With Worksheets("Presenze").Range(Cells(RR, 1), Cells(RR + 8, 5))
Set C = .Find(N, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
firstAddress = C.Address
VN(N) = VN(N) + 1
GoTo esci
Do
Set C = .FindNext(C)
If firstAddress = C.Address Then Exit Do
VN(N) = VN(N) + 1
GoTo esci
Loop While Not C Is Nothing And C.Address <> firstAddress
End If
esci:
End With
Next RR
'<<<< routine che inserisce le presenze in colonna T e la percentuale presenze in Colonna U
Range("T" & N).Value = VN(N)
Range("U" & N).Value = VN(N) / Gr
Range("U" & N).NumberFormat = "0%"
'<<<< routine inserisce solo i numeri sempre presenti nella colonna Z
If VN(N) = 9 Then Range("Z" & Rows.Count).End(xlUp).Offset(1, 0).Value = VN(N)
Next N
Columns("S:U").Sort Key1:=Range("T1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Ciao
P.s. Dopo l'esecuzione della macro noterai che in colonna Z non c'è alcun numero riportato proprio perché non esiste alcun numero presente in tutti e 9 i blocchi