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
|
Sub Macro2()
Dim WS As Worksheet
Dim NBligne As Long, NBcolonne As Long, i As Long, j As Long, compteur As Long
Set WS1 = ThisWorkbook.Worksheets("Feuil1")
Set WS2 = ThisWorkbook.Worksheets("Feuil2")
With WS1
NBligne = .Cells(.Rows.Count, 1).End(xlUp).Row
NBcolonne = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
compteur = 1
For i = 2 To NBligne
If WS1.Cells(i, 2) = "1110" Then
compteur = compteur + 1
For j = 1 To NBcolonne - 6
If WS1.Cells(i, 2) = "1110" And WS1.Cells(i, j + 6) <> "(NULL)" Then
WS2.Cells(compteur, j) = WS1.Cells(i, j + 6)
ElseIf WS1.Cells(i, 2) <> "1110" Then
compteur = compteur
Else
compteur = compteur
End If
Next j
End If
Next i
End Sub |
Partager