1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
Sub INITIALES()
'initialise le compteur Début
tmp = GetTickCount64
Application.ScreenUpdating = False
Dim initiale As String
Dim d As Range
Dim n As Variant
Dim Tableau()
Set dictionnaire = CreateObject("Scripting.Dictionary")
i = Range("B65000").End(xlUp).Row
Set plage = Range("a6:a" & i)
Range("b6").Select
n = 1
For Each d In plage
If dictionnaire.exists(d.Value) Then
Do
If ActiveCell.Offset(0, 3).Text Like "*Visage*" Or ActiveCell.Offset(0, 3).Text Like "*Bébé*" Or _
ActiveCell.Offset(0, 3).Text Like "*Rincés*" Then
initiale = Mid((ActiveCell.Offset(0, 1).Value), 1, 1) & Mid((ActiveCell.Offset(0, 0).Value), n, 1)
Else
initiale = Mid((ActiveCell.Offset(0, 1).Value), 1, 1) & Mid((ActiveCell.Offset(0, 0).Value), n, 1) & _
Right(ActiveCell.Offset(0, 0).Value, 1)
End If
n = n + 1
Loop Until Not dictionnaire.exists(d.Value)
ActiveCell.Offset(0, -1) = initiale
dictionnaire.Add d.Value, d.Value
n = 1
Else
If Not dictionnaire.exists(d.Value) Then
If ActiveCell.Offset(0, 3).Text Like "*Visage*" Or ActiveCell.Offset(0, 3).Text Like "*Bébé*" Or _
ActiveCell.Offset(0, 3).Text Like "*Rincés*" Then
initiale = Mid((ActiveCell.Offset(0, 1).Value), 1, 1) & Mid((ActiveCell.Offset(0, 0).Value), 1, 1)
Else
initiale = Mid((ActiveCell.Offset(0, 1).Value), 1, 1) & Mid((ActiveCell.Offset(0, 0).Value), 1, 1) & _
Right(ActiveCell.Offset(0, 0).Value, 1)
End If
ActiveCell.Offset(0, -1) = initiale
dictionnaire.Add d.Value, d.Value
End If
End If
ActiveCell.Offset(1, 0).Select
Next d
Call ColoriageDoublons
'Initialise le compteur Fin
tmpFin = GetTickCount64
Application.ScreenUpdating = True
MsgBox ("durée ; " & (tmpFin - tmp) / 1000 & " secondes.") '1,625 sans application.screenUpdating / 0,188 avec
End Sub |
Partager