Private Sub CommandButton1_Click()
tablo = Range("A1:D" & Range("A" & Rows.Count).End(xlUp).Row)
ecart = 9 ^ 9
For n = LBound(tablo, 1) To UBound(tablo, 1)
If Abs(CDbl(tablo(n, 1)) - CDbl(CDate(Me.TextBox1))) < ecart Then
ecart = Abs(CDbl(tablo(n, 1)) - CDbl(CDate(Me.TextBox1)))
a = tablo(n, 1)
b = tablo(n, 3)
End If
Next
Sheets("W").Range("A2") = a
Sheets("W").Range("B2") = b
Sheets("W").Select
Unload Me
End Sub