bonjour
dans VBA la fonction Like fonctionne quand je limite un champ compris entre 0 et 9 mais pas au delas
vous devrez comprendre dans ces exemples
Code:
Sub exemple1()
ma_variable = "5"
If ma_variable Like "[4-7]" Then ' => VRAI
MsgBox ("ok")
End If
End Sub
Sub exemple2()
ma_variable = "32"
If ma_variable Like "[30-40]" Then ' => FAUX!!
MsgBox ("ok")
End If
End Sub
c'est la méme procédure sauf les nombres qui changent
Option Explicit
Sub exemple1()
Dim ma_variable
ma_variable = "5"
MsgBox ma_variable Like "[4-7]"
End Sub
Sub exemple2()
Dim ma_variable
ma_variable = "32"
MsgBox ma_variable Like "3#"
End Sub
Bonjour modeste et jemmy.
Pour en rajouter une couche suivant la comparaison voulu, choisir entre # ou ?
Code:
Sub exemple2()
Dim ma_variable
ma_variable = "3a"
MsgBox ma_variable Like "3#" ' renvoie faux
End Sub
Sub exemple3()
Dim ma_variable
ma_variable = "3a"
MsgBox ma_variable Like "3?" ' renvoie vrai
End Sub