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 36 37 38 39
| Sub toto()
Dim Cell As Range
Dim Tabl(1 To 132, 1 To 3)
Application.ScreenUpdating = False
Tabl(1, 1) = "TEMPS"
Tabl(1, 2) = "FREQUENCE"
Tabl(1, 3) = "VALEUR"
Feuil2.Cells.Delete
With Feuil1
' boucle sur les colonnes
For i = 2 To .UsedRange.Columns.Count - 1
' filtre automatique
With .Cells(1, 1)
.AutoFilter
' on filtre les valeurs inférieures ou égales à 0,2
.AutoFilter i, "<=0.2"
End With
' on cherche la cellule approchant de 0,2
Set Cell = .Columns(i).SpecialCells(xlCellTypeVisible).Find(Application.WorksheetFunction.Subtotal(4, .Cells(2, i).Resize(UsedRange.Rows.Count - 1, 1)), , , xlWhole)
' si elle existe
If Not Cell Is Nothing Then
' écriture du temps et fréquence
Tabl(i, 1) = .Cells(1, i)
Tabl(i, 2) = .Cells(Cell.Row, 1)
Tabl(i, 3) = .Cells(Cell.Row, i)
End If
Next i
End With
' restitution du tableau de résultat
Feuil2.Cells(1, 1).Resize(UBound(Tabl, 1), 3).Value = Tabl
Application.ScreenUpdating = True
End Sub |
Partager