Bonjour à tous,
Je viens vers vous car j'essaye de comparer 2 variables mais j'ai un erreur de type mismatch...
Je ne vois pas très bien d'où ça peut venir...
Dim numCde
numCde = Val(TextBox1)
Dim R As Variant
R = Application.VLookup(numCde, CommandTable, 1, False)
If R <> numCde Then
MsgBox "ok"
Else
MsgBox "not ok"
End If
Je vous remercie d'avance pour vos retours
Dim numCde ok mais quoi ? as string as integer ?
Ensuite : numCde = Val(TextBox1) c'est plutôt :
numCde = Textbox1.value
<> de en vba il vaut mieux inverser pour donner la condition si = à
Dim numCde As String
numCde = TextBox1.value
Dim R As Variant
R = Application.VLookup(numCde, CommandTable, 1, False)
If R = numCde Then
MsgBox "Not ok"
Else
MsgBox "Ok"
End If