[COLOR="DarkSlateGray"]Sub sous()
Dim oPlg, nPlg As Long, tDat, nDat As Long, nLig As Long, nCol As Long, nOff As Long
Dim t As Single [COLOR="SeaGreen"]'***[/COLOR]
nOff = 8 [COLOR="SeaGreen"]' Paramètre.[/COLOR]
nLig = 5 [COLOR="SeaGreen"]' Paramètre.[/COLOR]
With ActiveSheet
For nCol = 2 To 4 [COLOR="SeaGreen"]' Paramètres.[/COLOR]
t = Timer [COLOR="SeaGreen"]'***[/COLOR]
nDat = 0
oPlg = .Range(.Cells(nLig, nCol), .Cells(.Rows.Count, nCol).End(xlUp)).Value [COLOR="SeaGreen"]' Données[/COLOR]
ReDim tDat(1 To 1, 1 To 1)
For nPlg = 1 To -1 + UBound(oPlg, 1)
[COLOR="SeaGreen"]' Au choix, une seule des trois lignes suivantes.
' If oPlg(nPlg, 1) = 1 And Not IsEmpty(oPlg(nPlg + 1, 1)) Then
' If oPlg(nPlg, 1) = 1 And oPlg(nPlg + 1, 1) <> "" Then[/COLOR]
If oPlg(nPlg, 1) = 1 Then
nDat = 1 + nDat
tDat(1, nDat) = oPlg(nPlg + 1, 1)
ReDim Preserve tDat(1 To 1, 1 To 1 + nDat)
End If
Next nPlg
.Cells(nLig, nOff + nCol) = " " [COLOR="SeaGreen"]' Pour le cas où la colonne serait vide.[/COLOR]
.Range(.Cells(nLig, nOff + nCol), .Cells(.Rows.Count, nOff + nCol).End(xlUp)).ClearContents
.Cells(nLig, nOff + nCol).Resize(UBound(tDat, 2), 1) = Application.Transpose(tDat)
.Cells(1, nOff + nCol).Value = Int(100 * (Timer - t) + 0.5) / 100 [COLOR="SeaGreen"]'***[/COLOR]
Next nCol
End With
End Sub[/COLOR]