VBA Number of days between dates

preview_player
Показать описание
Quickly count the number of days between two dates.

Code:
Sub nb_days_between_2_dates()

'find the number of days between two dates

Dim first_date As Date
Dim second_date As Date
Dim nb_days As Long

'identify dates
first_date = "1/1/2019"
second_date = "1/31/2020"

'find number of days between the dates
nb_days = DateDiff("d", first_date, second_date)

'message
MsgBox ("There are " & nb_days & " days between the " & first_date & " and the " & second_date)

End Sub

-------------------------------
NEED HELP?
-------------------------------
Leave a comment with your questions, issues or projetcs and I will try to answer with a video.

-------------------------------
THANK YOU
-------------------------------
For watching my videos,
Your shares
And your comments!
Рекомендации по теме