![]() |
VBA: Date Comparison
In VBA, I want to compare an input date (mm/dd/yy) with the current system
date and return either positive (input date prior to current date) or negative (input date precedes current date) days. |
VBA: Date Comparison
Hi,
'declare variables Dim dat As Date Dim days As Integer 'enter date as text, change to date format and save in variable dat dat = CDate(InputBox("Enter Date (mm/dd/yy)")) 'subtract entered date from systemdate and save result in variable days days = Date - dat Regards Ingolf |
VBA: Date Comparison
Thank you! I have implemented it and it works.
"Ingolf" wrote: Hi, 'declare variables Dim dat As Date Dim days As Integer 'enter date as text, change to date format and save in variable dat dat = CDate(InputBox("Enter Date (mm/dd/yy)")) 'subtract entered date from systemdate and save result in variable days days = Date - dat Regards Ingolf |
All times are GMT +1. The time now is 02:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com