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
| Sub Un_seul_Tableau()
Dim rng As Range, c As Range
Dim n As Integer, i As Integer
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
ReDim tablo(1 To 2, 1 To 1) As Variant
n = 0
For Each c In rng
If c >= 0 Then
Else
n = n + 1
ReDim Preserve tablo(1 To 2, 1 To n) As Variant
tablo(1, n) = c.Value
tablo(2, n) = c.Offset(0, 1).Value
End If
Next c
t = Application.Transpose(tablo)
' Application.Index(t, , 1) 'retourne la premiere colonne du tableau
' Application.Index(t, , 2) 'retourne la seconde colonne du tableau
cc = WorksheetFunction.Correl(Application.Index(t, , 1), Application.Index(t, , 2))
End Sub |
Partager