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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| Option Explicit
Public ligneHFCPositif As Long, ligneHFCNegatif As Long
Public trancheMinimun As Long, trancheMaximum As Long
Public n As Long
Public tableauDynamique As Object
Function conditionMultiple()
Dim marque As String, typeEvaporateur As String, famille As String, KS As Long
Dim nombreMarqueTrouve As Long
Dim plageMarque As String
Dim plageTypeEvaporateure As String
Dim plageFamille As String
Dim plageKS As String
Dim Cell As Range
Dim tableauDynamique()
n = 0
ReDim tableauDynamique(n, 5)
marque = ActiveCell.Offset(0, -10).Value
typeEvaporateur = ActiveCell.Offset(0, -9).Value
famille = ActiveCell.Offset(0, -4).Value
KS = ActiveCell.Offset(0, -1).Value
Call calculTrancheKS(KS)
Call compteurLignes("HFC POSITIF")
plageMarque = "B18:B" & ligneHFCPositif
plageTypeEvaporateure = "C18:C" & ligneHFCPositif
plageFamille = "B18:B" & ligneHFCPositif
plageKS = "A18:A" & ligneHFCPositif
If famille = "HFC" Then
famille = "R404A"
Else
famille = "CO2"
End If
Sheets("HFC POSITIF").Range(plageMarque).Select
For Each Cell In Selection
If marque = ActiveCell.Value And typeEvaporateur = ActiveCell.Offset(0, 1).Value And famille = ActiveCell.Offset(0, 3).Value Then
If KS > trancheMinimun And KS < trancheMaximum Then
tableauDynamique(n, 0) = ActiveCell.Offset(0, -1)
tableauDynamique(n, 1) = ActiveCell.Offset(0, 0)
tableauDynamique(n, 2) = ActiveCell.Offset(0, 1)
tableauDynamique(n, 3) = ActiveCell.Offset(0, 3)
tableauDynamique(n, 4) = ActiveCell.Offset(0, 2)
tableauDynamique(n, 5) = ActiveCell.Offset(0, 12)
n = n + 1
ReDim Preserve tableauDynamique(n, 5)
End If
End If
Next Cell
MsgBox (tableauDynamique(n, 6))
End Function
Public Function compteurLignes(feuille As String)
Dim derniereLigne As Long
derniereLigne = 0
Worksheets(feuille).Activate
Range("A" & Rows.Count).End(xlUp).Select
derniereLigne = Range("A" & Rows.Count).End(xlUp).Row
If feuille = "HFC POSITIF" Then
ligneHFCPositif = derniereLigne
End If
If feuille = "HFC NEGATIF" Then
ligneHFCNegatif = derniereLigne
End If
End Function
Function calculTrancheKS(celluleCalculKS As Long)
trancheMinimun = celluleCalculKS * 0.75
trancheMaximum = celluleCalculKS * 1.25
End Function
Function triTableauDynamique()
Quick tableauDynamique(), LBound(tableauDynamique), UBound(tableauDynamique), 1, True
End Function
Sub afficheRechercheTrouve()
Call conditionMultiple
Call triTableauDynamique
'MsgBox (tableauDynamique(n, 6))
End Sub |
Partager