Hi Excel Gurus,
i am trying to make a user form with two msg boxes (To and From Date).
In excel spreadsheet It was rather easy to bring a popup msg if they were invalid under some stated rules. please see below a rationale of the rules where A3=From Date and B3 To Date and the desired outcome of is:
So i wonder if it is possible to make a VBA code to validate these two dates? and bring a warning msg after keypress or after pressing submitcmd or any other available if available
Thank you
i am trying to make a user form with two msg boxes (To and From Date).
In excel spreadsheet It was rather easy to bring a popup msg if they were invalid under some stated rules. please see below a rationale of the rules where A3=From Date and B3 To Date and the desired outcome of is:
Code:
1.=IF(AND(ISBLANK(A3),ISBLANK(B3)),"Supply From and To Dates","")
2.=IF(AND(NOT(ISBLANK(B3)),ISBLANK(A3)),"supply From Date","")
3.=IF(AND(NOT(ISBLANK(A3)),ISBLANK(B3)),"supply To Date","")
4.=IF(NOT(EDATE($A$3,12)>=$B$3),"To date is more than 1 year after From Date",""))
5.=IF(NOT($A3<$B3),"To date needs to be later than From Date"
and the all concluding formula:
=IF(AND(ISBLANK($A3),ISBLANK($B3)),"Supply From and To Dates",IF(AND(NOT(ISBLANK($A3)),ISBLANK($B3)),"supply To Date",IF(AND(NOT(ISBLANK($B3)),ISBLANK($A3)),"supply From Date",IF(NOT($A3<$B3),"To date needs to be later than From Date",IF(NOT(EDATE($A3,12)>=$B3),"To date is more than 1 year after From Date","")))))
So i wonder if it is possible to make a VBA code to validate these two dates? and bring a warning msg after keypress or after pressing submitcmd or any other available if available
Thank you