1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Private Sub CommandButton1_Click()
'Déclaration des variables'
Dim RechercheTrouve As Range
Dim Résultat As Variant
'Activation de la feuille Suivi_2010'
Worksheets("Suivi_2010").Activate
Range("C2").Activate
'On donne une valeur a la variable résultat'
Résultat = TextBox1.Value
Set RechercheTrouve = Cells.Find(What:=Résultat, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
'Si la recherche est négatif, un messagebox previent'
If RechercheTrouve Is Nothing Then
MsgBox "Le numéro d'OS n'existe pas", vbCritical
Else
Cells.Find(What:=Résultat).Activate
End If
End Sub |