| | Post: 3.467 | Registrato il: 28/06/2011
| Città: AGORDO | Età: 70 | Utente Master | 2013 | | OFFLINE | |
|
16/05/2018 18:11 | |
Prova in questo modo, comunque il mio era più veloce in caso di 100.000 righe vb 'Option Explicit ' solo se dichiari le variabili
Sub DOPPIONI2()
'Dim dichiarare le variabili...
xRiga = Cells(Rows.Count, 1).End(xlUp).Row 'Conto le righe occupate alla colonna A
Range("AE1:AE" & xRiga).ClearContents
For i = 2 To xRiga
Data = Cells(i, 2) 'determino la colonna Data (B)
CODICE1 = Cells(i, 3) 'determino la colonna CODICE1 (C)
CODICE2 = Cells(i, 10) 'determino la colonna CODICE2 (F)
For x = i + 1 To xRiga
If CODICE1 = Cells(x, 3) And CODICE2 = Cells(x, 10) Then
If Cells(x, 2) < Data Then Cells(i, 31) = "Oltre"
If Cells(x, 2) = Data Then Cells(i, 31) = "Pari"
If Cells(x, 2) > Data Then Cells(i, 31) = "Minore"
End If
Next x
Next i
For i = 2 To xRiga
For x = i To xRiga
If Cells(x, 31) = "Oltre" Then Cells(x, 31) = ""
If Cells(x, 31) = "Pari" Then Cells(x, 31) = "DUPLICATO CON STESSA DATA"
If Cells(x, 31) = "Minore" Then Cells(x, 31) = "DUPLICATO DA ELIMINARE"
Next x
Next i
MsgBox "Completed"
End Sub Excel 2013 |
|
|