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
| Function Severity_Level(Id_ER As String) As Variant
Application.Volatile True 'recalcule immédiatement
Dim Ligne, Colonne As Integer
Dim Deb_Ligne, Fin_Ligne As Integer
Dim Severity_Level_New As Integer
Dim i As Integer
'Zone du tableau de l'onglet "UE_List" où se trouvent les identifiants des évènements redoutés
Deb_Ligne = 4
Fin_Ligne = 25
Severity_Level = ""
Tableau = Split(Id_ER, Chr(10)) 'Permet de mettre dans le tableau les caractères de la chaîne d'identifiants espacés du caractère spécial "Retour à la ligne <=> Ch(10)
For i = 0 To UBound(Tableau) '1° Boucle sur chaque identifiant
Id_ER = Tableau(i)
With ThisWorkbook.Worksheets("UE_List") 'Ici, on récupère le niveau de gravité
For Ligne = Deb_Ligne To Fin_Ligne
If .Cells(Ligne, 1).Value = Id_ER Then
Severity_Level_New = .Cells(Ligne, 3).Value
End If
Next Ligne
End With
End Function
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 3 Then Range("N3") = Severity_Level(???)
End Sub |
Partager