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
| Sub suite()
Dim x As Integer, Dc As Range
Dim n1 As Integer, n2 As Integer
'With Sheets("Feuil2")
With Sheets("SynthèseR1")
Set Dc = .Range(.Range("Y4"), .Range("Y4").End(xlToLeft))
.Range("Y5", Dc(2, 1)).NumberFormat = "@"
For x = 25 To Dc.Column Step 2
n1 = CInt(Split(.Cells(4, x), "--")(0) - 1)
n2 = CInt(Split(.Cells(4, x), "--")(1) - 1)
MsgBox CStr(.Cells(5, n1 + 5)) & "-" & CStr(.Cells(5, n2 + 5))
'.Cells(3, x) = CStr(Feuil1.Cells(2, n1 + 11)) & "-" & CStr(Feuil1.Cells(2, n2 + 11))
.Cells(5, x) = CStr(.Cells(5, n1 + 5)) & "-" & CStr(.Cells(5, n2 + 5))
Next x
n1 = 1
fin = False
For x = 4 To 6
Do
If Dc.Cells(1, n1) = .Cells(x, 1) Then
Dc.Cells(3, n1) = .Cells(2, 17 + x)
If x = 4 Then Dc.Cells(4, n1) = .Cells(2, 16 + x)
fin = True
End If
n1 = n1 + 1
Loop Until n1 = Dc.Count + 1 Or fin
fin = False
n1 = 1
Next x
End With
End Sub |
Partager