Re : dans une meme cellule, ajoute de 2 resultat if then
Dranreb re bonsoir,
J'ai commencé a me pencher sur ta remarque, mais je calle.
J'ai actuellement un code suivant :
Private Sub TBHFF_Change()
' Affichage des cote D dans le comcocox CBcoted selon les HFF.
With CBtypedouvrant.Value = "OB" Or CBtypedouvrant.Value = "OF renvoi d'angle"
If CLng(TBHFF.Value) >= "2276" And CLng(TBHFF.Value) <= "2725" Then
CBcoted.List = Array("", "1050")
CBcoted.Text = "1050"
ElseIf CLng(TBHFF.Value) >= "1751" And CLng(TBHFF.Value) <= "2275" Then
CBcoted.List = Array("", "550", "1050")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1696" And CLng(TBHFF.Value) <= "1750" Then
CBcoted.List = Array("", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1601" And CLng(TBHFF.Value) <= "1695" Then
CBcoted.List = Array("", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1446" And CLng(TBHFF.Value) <= "1600" Then
CBcoted.List = Array("", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1350" And CLng(TBHFF.Value) <= "1445" Then
CBcoted.List = Array("", "164", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1211" And CLng(TBHFF.Value) <= "1349" Then
CBcoted.List = Array("", "164", "210", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1076" And CLng(TBHFF.Value) <= "1210" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "946" And CLng(TBHFF.Value) <= "1075" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375", "470")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "851" And CLng(TBHFF.Value) <= "945" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "581" And CLng(TBHFF.Value) <= "850" Then
CBcoted.List = Array("", "114", "164", "210", "260")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "485" And CLng(TBHFF.Value) <= "580" Then
CBcoted.List = Array("", "114", "164", "210")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "421" And CLng(TBHFF.Value) <= "484" Then
CBcoted.List = Array("", "114", "210")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "230" And CLng(TBHFF.Value) <= "420" Then
CBcoted.List = Array("", "114")
CBcoted.Text = ""
End If
End With
Sheets("parametre").Range("j3").Value = TBHFF.Value
End Sub
Pour essayer, j'ai créer un module appelé choix_cote_D. Dedans j'ai copier le code :
Private sub choix_coted ()
' Affichage des cote D dans le comcocox CBcoted selon les HFF.
With CBtypedouvrant.Value = "OB" Or CBtypedouvrant.Value = "OF renvoi d'angle"
If CLng(TBHFF.Value) >= "2276" And CLng(TBHFF.Value) <= "2725" Then
CBcoted.List = Array("", "1050")
CBcoted.Text = "1050"
ElseIf CLng(TBHFF.Value) >= "1751" And CLng(TBHFF.Value) <= "2275" Then
CBcoted.List = Array("", "550", "1050")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1696" And CLng(TBHFF.Value) <= "1750" Then
CBcoted.List = Array("", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1601" And CLng(TBHFF.Value) <= "1695" Then
CBcoted.List = Array("", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1446" And CLng(TBHFF.Value) <= "1600" Then
CBcoted.List = Array("", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1350" And CLng(TBHFF.Value) <= "1445" Then
CBcoted.List = Array("", "164", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1211" And CLng(TBHFF.Value) <= "1349" Then
CBcoted.List = Array("", "164", "210", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "1076" And CLng(TBHFF.Value) <= "1210" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375", "470", "550")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "946" And CLng(TBHFF.Value) <= "1075" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375", "470")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "851" And CLng(TBHFF.Value) <= "945" Then
CBcoted.List = Array("", "114", "164", "210", "260", "375")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "581" And CLng(TBHFF.Value) <= "850" Then
CBcoted.List = Array("", "114", "164", "210", "260")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "485" And CLng(TBHFF.Value) <= "580" Then
CBcoted.List = Array("", "114", "164", "210")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "421" And CLng(TBHFF.Value) <= "484" Then
CBcoted.List = Array("", "114", "210")
CBcoted.Text = ""
ElseIf CLng(TBHFF.Value) >= "230" And CLng(TBHFF.Value) <= "420" Then
CBcoted.List = Array("", "114")
CBcoted.Text = ""
End If
End With
End sub
Dans le code Private Sub TBHFF_Change() de mon userforme1, j'ai suprimé toute cette partie. si bien que j'ai a présent mis les lignes suivantes :
Private Sub TBHFF_Change()
call choix_coted
Sheets("parametre").Range("j3").Value = TBHFF.Value
End Sub
mais il ne se passe rien. Pourtant il me semble que c'est comme ça qu'on appel un module?
Pourrais tu me dire d’où viens mon erreur car bien entendu, ça ne fonctionne pas.