Mon test qui a l'air de fonctionner en cherchant de le texte qu'en pensez vous de cette amélioration
Sub sText()
'Déclarations & Types
Dim P1A#, P1B#, P1C#, P1D#, P1E#, P1F#
Dim P2A#, P2B#, P2C#, P2D#, P2E#, P2F#
Dim P3A#, P3B#, P3C#, P3D#, P3E#, P3F#
Dim P4A#, P4B#, P4C#, P4D#, P4E#, P4F#
Const Lignes% = 60
'Affectation
For i = 2 To Lignes
If Cells(i, 1) = "1-01-A" Then
P1A = Cells(i, 2)
ElseIf Cells(i, 1) = "1-01-B" Then
P1B = Cells(i, 2)
ElseIf Cells(i, 1) = "1-02-C" Then
P1C = Cells(i, 2)
ElseIf Cells(i, 1) = "1-02-D" Then
P1D = Cells(i, 2)
ElseIf Cells(i, 1) = "1-03-E" Then
P1E = Cells(i, 2)
ElseIf Cells(i, 1) = "1-03-F" Then
P1F = Cells(i, 2)
ElseIf Cells(i, 1) = "2-01-A" Then
P2A = Cells(i, 2)
ElseIf Cells(i, 1) = "2-01-B" Then
P2B = Cells(i, 2)
ElseIf Cells(i, 1) = "2-02-C" Then
P2C = Cells(i, 2)
ElseIf Cells(i, 1) = "2-02-D" Then
P2D = Cells(i, 2)
ElseIf Cells(i, 1) = "2-03-E" Then
P2E = Cells(i, 2)
ElseIf Cells(i, 1) = "2-03-F" Then
P2F = Cells(i, 2)
ElseIf Cells(i, 1) = "3-01-A" Then
P3A = Cells(i, 2)
ElseIf Cells(i, 1) = "3-01-B" Then
P3B = Cells(i, 2)
ElseIf Cells(i, 1) = "3-02-C" Then
P3C = Cells(i, 2)
ElseIf Cells(i, 1) = "3-02-D" Then
P3D = Cells(i, 2)
ElseIf Cells(i, 1) = "3-03-E" Then
P3E = Cells(i, 2)
ElseIf Cells(i, 1) = "3-03-F" Then
P3F = Cells(i, 2)
ElseIf Cells(i, 1) = "4-01-A" Then
P4A = Cells(i, 2)
ElseIf Cells(i, 1) = "4-01-B" Then
P4B = Cells(i, 2)
ElseIf Cells(i, 1) = "4-02-C" Then
P4C = Cells(i, 2)
ElseIf Cells(i, 1) = "4-02-D" Then
P4D = Cells(i, 2)
ElseIf Cells(i, 1) = "4-03-E" Then
P4E = Cells(i, 2)
ElseIf Cells(i, 1) = "4-03-F" Then
P4F = Cells(i, 2)
End If
Next
'Appel
Cells(2, 4) = P1A
Cells(3, 4) = P1B
Cells(4, 4) = P1C
Cells(5, 4) = P1D
Cells(6, 4) = P1E
Cells(7, 4) = P1F
Cells(8, 4) = P2A
Cells(9, 4) = P2B
Cells(10, 4) = P2C
Cells(11, 4) = P2D
Cells(12, 4) = P2E
Cells(13, 4) = P2F
Cells(14, 4) = P3A
Cells(15, 4) = P3B
Cells(16, 4) = P3C
Cells(17, 4) = P3D
Cells(18, 4) = P3E
Cells(19, 4) = P3F
Cells(20, 4) = P4A
Cells(21, 4) = P4B
Cells(22, 4) = P4C
Cells(23, 4) = P4D
Cells(24, 4) = P4E
Cells(25, 4) = P4F
End Sub