Lucio Peruggini ha scritto: avrei la necessità di marcare i numeri (minimo 2) della colonna “B”.
Nella colonna "B" non ci sono dei numeri ma la sigla delle ruote
Moderatori: Anthony47, Flash30005
Lucio Peruggini ha scritto: avrei la necessità di marcare i numeri (minimo 2) della colonna “B”.
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
MN = Array(VNA(1), VNA(2), VNA(3), VNA(4), VNA(5))
For RR1 = 8 To UR1
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Len(Ambo) > 5 Then Ws2.Cells(RR1, 11).Value = Mid(Ambo, 3, Len(Ambo))
Next RR1
Next CCA
End Sub
Laddove non si riscontrassero corrispondenze, la colonna “J, L e Q” devono aumentare di un’unità; quelle invece che hanno dato esito positivo (medesima corrispondenza) si fermano a quel punto. Non devono più essere conteggiate quando nel foglio archivio, si cambia estrazione. In tal caso la colonna “O” riporterà la dicitura ”positivo”.
Flash30005 ha scritto:Scusami ma continuo a non capire
prendendo in considerazione il tuo ultimo file (ho visto che hai utilizzato la mia macro) cos'altro si dovrebbe fare?
fai un esempio pratico con immagini o altro perché per me è tutto così aleatorio
ciao
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
MN = Array(VNA(1), VNA(2), VNA(3), VNA(4), VNA(5))
For RR1 = 8 To UR1
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Len(Ambo) > 5 And Ws2.Cells(RR1, 11).Value = "" Then
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Len(Ws2.Cells(RR1, 11).Value) > 13 Then Ws2.Cells(RR1, 15).Value = "Quaterna"
End If
Next RR1
Next CCA
End Sub
Sub ResetT()
Set Ws2 = Worksheets("Attuali")
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("K8:K" & UR1).ClearContents
Ws2.Range("O8:O" & UR1).ClearContents
Ws2.Range("P8:P" & UR1).Value = "In corso"
End Sub
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
MN = Array(VNA(1), VNA(2), VNA(3), VNA(4), VNA(5))
For RR1 = 8 To UR1
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Len(Ambo) > 5 And Ws2.Cells(RR1, 11).Value = "" Then
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Cells(RR1, 14).Value = "Sto"
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Len(Ws2.Cells(RR1, 11).Value) > 13 Then Ws2.Cells(RR1, 15).Value = "Quaterna"
End If
Next RR1
Next CCA
End Sub
Sub ResetT()
Set Ws2 = Worksheets("Attuali")
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
Ws2.Range("K8:K" & UR1).ClearContents
Ws2.Range("O8:O" & UR1).ClearContents
Ws2.Range("P8:P" & UR1).Value = "In corso"
Ws2.Range("N8:N" & UR1).Value = "Att"
End Sub
Lucio Peruggini ha scritto:Vi è poi il discorso sul numero spia colonna “C”.
Se questo numero lo troviamo nella riga Archivio ed è altresì presente anche nel foglio Attuali, ma non vi è stato nessun esito positivo nella colonna “ K” <dev’essere aggiunto>.
In questo caso sono usciti tre numeri: due su Napoli il 45 e 55; uno su Torino l’81.
Perciò, nella riga successiva la 144 bisogna aggiungere il 45; in quella successiva la 153 aggiungere il 55; dopo la riga 260 aggiungere il 45.
P.s. Ma una passeggiata nei boschi con le foglie gialle che fanno da tappeto e riempire i polmoni di sana aria con aroma di muschio... no eh?
Sub TrovaAgg()
Set Ws1 = Worksheets("Archivio")
Set Ws2 = Worksheets("Attuali")
'Ws2.Range("K8:K1000").ClearContents
For CCA = 3 To 48 Step 5
Dim VNA(90) As Integer
RuA = UCase(Trim(Ws1.Cells(1, CCA)))
For NV = 1 To 90
For Onu = 1 To 5
If NV = Ws1.Cells(2, CCA + Onu - 1).Value Then VNA(Onu) = Ws1.Cells(2, CCA + Onu - 1).Value
Next Onu
Next NV
UR1 = Ws2.Range("B" & Rows.Count).End(xlUp).Row
MN = Array(VNA(1), VNA(2), VNA(3), VNA(4), VNA(5))
For RR1 = 8 To UR1
Ambo = ""
If UCase(Trim(Ws2.Range("B" & RR1).Value)) = UCase(Trim(RuA)) Then
For NV = 1 To 5
For NP = 1 To 5
If VNA(NV) = Ws2.Cells(RR1, 3 + NP).Value Then
Ambo = Ambo & " - " & VNA(NV)
End If
Next NP
Next NV
End If
If Ws2.Cells(RR1, 12).Value < Ws1.Range("A2").Value Then
DiffRit = Ws1.Range("A2").Value - Ws2.Cells(RR1, 9).Value
RuA2 = UCase(Trim(Ws2.Range("B" & RR1).Value))
If RuA = RuA2 Then
If Len(Ambo) > 5 Then
If Ws2.Cells(RR1, 11).Value = "" Then
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
Ws2.Cells(RR1, 14).Value = "Sto"
Ws2.Cells(RR1, 11).Value = Trim(Mid(Ambo, 3, Len(Ambo)))
Ws2.Cells(RR1, 16).Value = "Positivo"
Ws2.Cells(RR1, 15).Value = "Ambo"
If Len(Ws2.Cells(RR1, 11).Value) > 8 Then Ws2.Cells(RR1, 15).Value = "Terno"
If Len(Ws2.Cells(RR1, 11).Value) > 13 Then Ws2.Cells(RR1, 15).Value = "Quaterna"
Tr = 0
End If
Else
Tr = 1
'MsgBox Ws2.Cells(RR1, 10).Value
Ws2.Cells(RR1, 10).Value = DiffRit
Ws2.Cells(RR1, 12).Value = Ws1.Range("A2").Value
Ws2.Cells(RR1, 13).Value = CDate(Ws1.Range("B2").Value)
End If
End If
End If
Next RR1
Next CCA
End Sub
Discorso spie ancora incomprensibili perché le spie sono solo 3?
e poi per napoli corrispondono ai numeri costituenti l'ambo sfaldato e sarebbe comprensibile ma a Torino l'81 cos'è?
e perché non firenze dove è uscito l'ambo 56-9?
Torna a Applicazioni Office Windows
Macro che scatta quando cambia dato in un altro file Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 7 |
Problema con macro copia e rinomina file Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 2 |
Macro che ricerca combinazioni che danno un valore Autore: kar64 |
Forum: Applicazioni Office Windows Risposte: 10 |
Macro che indica la riga prima della cella attiva Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 19 |
Visitano il forum: Nessuno e 68 ospiti