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
| Sub Macro5()
'
' Macro5 Macro
Dim i As Byte, j As Byte, K As Byte
Dim WsSource As Worksheet, WsCible As Worksheet
Set WsSource = Worksheets("Feuil2")
Set WsCible = Worksheets("Feuil3")
j = 3 'Première ligne où sera effectuée la copie dans la feuille 3
For K = 3 To 100
If WsSource.Cells(6, K).Interior.ColorIndex = 6 Then
WsCible.Cells(j, 1).Value = Cells(6, K)
WsCible.Cells(j, 1).Interior.ColorIndex = 6
j = j + 1
ElseIf WsSource.Cells(9, K).Interior.ColorIndex = 6 Then
WsCible.Cells(j, 2).Value = Cells(9, K)
WsCible.Cells(j, 2).Interior.ColorIndex = 6
j = j + 1 'On incrémente la numéro de ligne où sera effectuée la copie dans la feuille 3
ElseIf WsSource.Cells(12, K).Interior.ColorIndex = 6 Then
WsCible.Cells(j, 3).Value = Cells(12, K)
WsCible.Cells(j, 3).Interior.ColorIndex = 6
j = j + 1
Else
End If
Next K
End Sub |
Partager