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
|
Sub Macro2()
a = 1
b = 4
For x = 1 To 13299
If Cells(x, 2).Value = "x" Then
If Cells(x + 4, 2).Value = "x" Then
y = x + 3
Cells(a, b).Value = Cells(x, 1).Value & Chr(10) & Cells(x + 1, 1).Value & Chr(10) & Cells(x + 2, 1).Value & Chr(10) & Cells(x + 3, 1).Value
GoTo suite
End If
If Cells(x + 5, 2).Value = "x" Then
y = x + 4
Cells(a, b).Value = Cells(x, 1).Value & Chr(10) & Cells(x + 1, 1).Value & Chr(10) & Cells(x + 2, 1).Value & Chr(10) & Cells(x + 3, 1).Value & Chr(10) & Cells(x + 4, 1).Value
GoTo suite
End If
If Cells(x + 6, 2).Value = "x" Then
y = x + 5
Cells(a, b).Value = Cells(x, 1).Value & Chr(10) & Cells(x + 1, 1).Value & Chr(10) & Cells(x + 2, 1).Value & Chr(10) & Cells(x + 3, 1).Value & Chr(10) & Cells(x + 4, 1).Value & Chr(10) & Cells(x + 5, 1).Value
GoTo suite
End If
If Cells(x + 7, 2).Value = "x" Then
y = x + 5
Cells(a, b).Value = Cells(x, 1).Value & Chr(10) & Cells(x + 1, 1).Value & Chr(10) & Cells(x + 2, 1).Value & Chr(10) & Cells(x + 3, 1).Value & Chr(10) & Cells(x + 4, 1).Value & Chr(10) & Cells(x + 5, 1).Value & Chr(10) & Cells(x + 6, 1).Value
GoTo suite
End If
suite:
b = b + 1
If b = 7 Then
b = 4
a = a + 1
End If
End If
Next x
End Sub |
Partager