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
| Sub correlation2()
Dim range0 As Range
Dim range1 As Range
Dim range2 As Range
Dim range3 As Range
Dim range4 As Range
Rem r0=distances non filtrées et sans distances nulles
Rem r1=distances filtrées et sans distances nulles
Rem r2=ratios non filtrés et sans distances nulles
Rem r3=ratios filtrés et sans distances nulles
Rem r4=ratios filtrés et sans distances nulles puis randomisés
Dim r0 As Range
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Dim r4 As Range
Dim i As Integer
Dim k As Integer
Dim j As Integer
Application.ScreenUpdating = False
For i = 1 To 1
For k = 1 To 20
If (Worksheets("residus").Cells(i + 3, k + 2).Value <> 0) Then
Set r0 = Range(Worksheets("residus").Cells(i + 3, k + 2), Worksheets("residus").Cells(i + 3, k + 2))
Set r2 = Range(Worksheets("Ratios").Cells(i + 2, 2), Worksheets("Ratios").Cells(i + 2, 2))
If (Worksheets("Ratios").Cells(k + 1, 3).Value = 1) Then
Set r1 = Range(Worksheets("residus").Cells(i + 3, k + 2), Worksheets("residus").Cells(i + 3, k + 2))
Set r3 = Range(Worksheets("Ratios").Cells(k + 1, 2), Worksheets("Ratios").Cells(k + 1, 2))
Set r4 = Range(Worksheets("Ratios").Cells(k + 22, 2), Worksheets("Ratios").Cells(k + 22, 2))
k = k + 20
End If
End If
Next k
For j = 1 To 20
If (Worksheets("residus").Cells(i + 3, j + 2).Value <> 0) Then
Set range0 = Range(Worksheets("residus").Cells(i + 3, j + 2), Worksheets("residus").Cells(i + 3, j + 2))
Set range2 = Range(Worksheets("Ratios").Cells(i + 2, 2), Worksheets("Ratios").Cells(i + 2, 2))
Set r0 = Union(r0, range0)
Set r2 = Union(r2, range2)
If (Worksheets("Ratios").Cells(j + 1, 3).Value = 1) Then
Set range1 = Range(Worksheets("residus").Cells(i + 3, j + 2), Worksheets("residus").Cells(i + 3, j + 2))
Set range3 = Range(Worksheets("Ratios").Cells(j + 1, 2), Worksheets("Ratios").Cells(j + 1, 2))
Set range4 = Range(Worksheets("Ratios").Cells(j + 22, 2), Worksheets("Ratios").Cells(j + 22, 2))
Set r1 = Union(r1, range1)
Set r3 = Union(r3, range3)
Set r4 = Union(r4, range4)
End If
End If
Next j
Worksheets("residus").Cells(i + 3, 31).Value = Application.WorksheetFunction.coefficient.correlation(r0, r2)
Worksheets("residus").Cells(i + 3, 32).Value = Application.WorksheetFunction.Sum(r2)
Worksheets("residus").Cells(i + 3, 33).Value = Application.WorksheetFunction.Sum(r2alea)
Next i
Application.ScreenUpdating = True
End Sub |
Partager