Merci pour voir réponse.
J'ai rajouté l'ensemble du module ci-dessous, j'obtiens à chaque fois un message d'erreur.
Private Sub Tolerance()
Dim Tol_TM As String
Dim Valeur_Max As String
TextBox5.Value = ""
TextBox6.Value = ""
TextBox5.BackColor = &H80000005
TextBox6.BackColor = &H80000005
Label12.Visible = False
Set ws = ActiveSheet
Dim niv As String
Dim toll As String
'Affichage de la valeur max et tolérance
For Each c In Range(ws.[B5], ws.[B65536].End(xlUp))
'Si même nom de site
If c = Me.ComboBox1 And c.Offset(, 3) = Me.ComboBox2 And c.Offset(, 16) = "TM" And c.Offset(, 5) = Me.ComboBox3 Then
' Donne le nom et l'unité à la valeur max
If c.Offset(, 47).Value = 65535 Then
Label12.Visible = True
TextBox5.BackColor = &H8686EB
End If
If TextBox7.Value = "" Then
Valeur_Max = c.Offset(, 47).Value
Else
Valeur_Max = TextBox7.Value
TextBox5.BackColor = &H8686EB '&H80000005 blanc
TextBox6.BackColor = &HAEFFFF
End If
If Me.ComboBox2.Value Like "7*" Then
niv = 7
Else
If Me.ComboBox2.Value Like "6*" Then
niv = 6
Else
If Me.ComboBox2.Value Like "5*" Then
niv = 5
Else
If Me.ComboBox2.Value Like "4*" Or Me.ComboBox2.Value Like "3*" Or Me.ComboBox2.Value Like "2*" Then
niv = 4
Else
If Me.ComboBox2.Value Like "1*" Then
niv = 1
Else
niv = "rien"
End If
End If
End If
End If
End If
' Donne le nom et l'unité à la valeur max
If Me.ComboBox3.Value Like "U*" And Not Me.ComboBox3.Value Like "U*P*P*" And Not Me.ComboBox3.Value Like "U*BAS*" And Not Me.ComboBox3.Value Like "U*CONS*" And Not Me.ComboBox3.Value Like "U*HAUT*" Then
toll = "U"
TextBox6.BackColor = &H80000005
Else
If Me.ComboBox3.Value Like "P*" And Not Me.ComboBox3.Value Like "P*H*I*" Then
toll = "P"
Else
If Me.ComboBox3.Value Like "Q*" Then
toll = "Q"
Else
toll = "Autre que U P Q"
End If
End If
End If
' If c.Offset(, 47).Value = 65535 Then
TextBox5.Value = c.Offset(, 47) & " " & c.Offset(, 48)
If toll = "U" And niv = "7" Then
Tol_TM = "TM/CONV < 6 kV ou TM/TM < 8 kV"
Else
If toll = "U" And niv = "6" Then
Tol_TM = "TM/CONV < 4 kV ou TM/TM < 5 kV"
Else
If toll = "U" And niv = "5" Then
Tol_TM = "TM/CONV < 3 kV ou TM/TM < 4 kV"
Else
If toll = "U" And niv = "4" Then
Tol_TM = "TM/CONV < 2 kV ou TM/TM < 3 kV"
Else
If toll = "U" And niv = "1" Then
Tol_TM = "TM/CONV < 1 kV ou TM/TM < 3 kV"
Else
If toll = "P" And niv = "7" Then
Tol_TM = "< " & Round(Valeur_Max * 0.0148 + 1, 0) & " MW"
Else
If toll = "P" And (niv = "6" Or niv = "5" Or niv = "4" Or niv = "1") Then
Tol_TM = " < " & Round(Valeur_Max * 0.0158 + 1, 0) & " MW"
Else
If toll = "Q" And niv = "7" Then
Tol_TM = "< " & Round(Valeur_Max * 0.0242 + 1, 0) & " MVar"
Else
If toll = "Q" And (niv = "6" Or niv = "5" Or niv = "4" Or niv = "1") Then
Tol_TM = "< " & Round(Valeur_Max * 0.0284 + 1, 0) & " MVar"
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Next c
TextBox6.Value = Tol_TM
End Sub
Le message d'erreur est Erreur d'exécution ' 13': Incompatibilité de type.
En vous remerciant encore pour votre aide.