i want vba code compare system date date mentioned in row (a) in excel worksheet. if dates equal should compare system time , time mentioned in row (b). eg: if time mentioned in sheet 7 30 pm , system time 7 pm, should calculate time between , display. if date in sheet not matches should leave.
thanks in advance.
i put small procedure started. assumes date/time in worksheet in cell a1. if system date same date in cell a1, compares system time time in cell a1. if same minute nothing happens.
however, if different number of minutes different appears in cell b1.
here code:
public sub datetimecheck() dim d double dim s1 string dim s2 string s1 = format([a1], "dd-mm-yyyy hh:mm") s2 = format(now, "dd-mm-yyyy hh:mm") if left$(s2, 10) = left$(s1, 10) d = timevalue(right$(s2, 5)) - timevalue(right$(s1, 5)) if d [b1] = d * 1440 end if end if end sub now, if have more cells dates in column , want compare them well, need modify code "processes" of them.
as far writing difference in minutes email... need more detail that!
Comments
Post a Comment