Dim Ligne As Long
Dim celluletrouvee As Range
Private Sub CommandButton1_Click()
If Trim(num.Text) = "" Then MsgBox "Vous devez entrer un numéro."
With Sheets("Base Travaux")
Set celluletrouvee = .Columns(2).Find(what:=num, after:=.Cells(9, 2), lookat:=xlWhole, LookIn:=xlValues)
If Not celluletrouvee Is Nothing Then
.Range("K" & celluletrouvee.Row).Select
.Range("J" & celluletrouvee.Row) = dateRPS
.Range("K" & celluletrouvee.Row) = montant
End If
Unload Me
End With
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub num_Enter()
Set celluletrouvee = Nothing
End Sub
Private Sub num_Exit(ByVal Cancel As MSForms.ReturnBoolean)
's'il n'y a rien (pas même une espace dans le textbox num) on sort
If Trim(num.Text) = "" Then Exit Sub
With Sheets("Base Travaux")
Set celluletrouvee = .Columns(2).Find(what:=num, after:=.Cells(9, 2), lookat:=xlWhole, LookIn:=xlValues)
If Not celluletrouvee Is Nothing Then
If IsDate(.Range("J" & celluletrouvee.Row)) Then dateRPS = Format(.Range("J" & celluletrouvee.Row), "dd/mm/yyyy")
montant = .Range("K" & celluletrouvee.Row)
Else
MsgBox "numéro non trouvé"
End If
End With
End Sub