Condition sur textbox

plumazon

XLDnaute Occasionnel
Bonsoir


j'aimerai mettre une condition sur un textbox

ci joint fichier explicatif


Mille merci [file name=Classeur1_20060511220608.zip size=7690]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/Classeur1_20060511220608.zip[/file]
 

Pièces jointes

  • Classeur1_20060511220608.zip
    7.5 KB · Affichages: 11

lio

XLDnaute Occasionnel
Salut,

Private Sub CommandButton1_Click()
If Range('A2').Value - Val(TextBox1.Value) inf 0 Then
MsgBox 'attention'
Exit Sub
Else
Range('b2').Value = TextBox1.Value
End If
End Sub

Changer inf par le signe ad hoc
 

porcinet82

XLDnaute Barbatruc
Salut Plumazon,

Il te suffit de modifier ton code de la manière suivante :
Code:
Private Sub CommandButton1_Click()
If Val(TextBox1.Value) < Cells(2, 1).Value Then
    MsgBox 'veuillez saisir une valeur supérieure au stock'
    Exit Sub
End If
Range('b2').Value = TextBox1.Value
End Sub

@+

Edition : Salut Lio, pas rafraichit ;)

Message édité par: porcinet82, à: 11/05/2006 22:29
 

Discussions similaires

Statistiques des forums

Discussions
312 211
Messages
2 086 295
Membres
103 171
dernier inscrit
clemm