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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| Sub sisi()
'copie g(1)norm et garder valeurs
Sheets("normalized g1").Select
Sheets("normalized g1").Copy Before:=Sheets(4)
'bouge la feuille copie
Sheets("normalized g1 (2)").Move After:=Sheets(5)
Sheets("normalized g1 (2)").Select
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'tracer Tau=f(t)
Sheets("normalized g1 (2)").Select
Dim Cell As Range
Dim Tabl(1 To 300, 1 To 3)
'empeche la visu des actions de la macro
Application.ScreenUpdating = False
Tabl(1, 1) = "time (min)"
Tabl(1, 2) = "Tau (ms)"
Tabl(1, 3) = "g(1) normalized"
Worksheets("Tau=f(t)").Cells.Delete
With Worksheets("normalized g1 (2)")
' 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.9"
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)
Set Cell = .Columns(i).SpecialCells(xlCellTypeVisible).Find(Application.WorksheetFunction.Subtotal(4, .Cells(2, i).Resize(.UsedRange.Rows.Count - 1, 1)), , xlFormulas, 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
Worksheets("Tau=f(t)").Cells(1, 1).Resize(UBound(Tabl, 1), 3).Value = Tabl
Worksheets("Tau=f(t)").Activate
End Sub |
Partager