Boa tarde!
Tente algo assim
Private Sub txtdata_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim MyDate As Date
Dim MyDate2 As Date
'Fonte: http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=316:excel-vba-date-time-functions-year-month-week-day-functions&catid=79&Itemid=475
MyDate = DateSerial(2017, 1, 1)
MyDate2 = DateSerial(2017, 1, 31)
If txtdata.Value < MyDate Or txtdata.Value > MyDate2 Then
MsgBox "A data deve ficar entre '01-31/01/2017' "
Else
MsgBox "OK"
End If
End Sub
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 24/08/2017 9:26 am