I am a newbie in vba and I am trying to get in vba all dates between 2 dates, for example I will call the function with the parameters 01-01-2015 and 15-01-2015, and I will get in return an array with all the dates possibles, i.e :
01-01-2015
02-01-2015
03-01-2015
.....
15-01-2015
I didn't find the answer on the forums, so thanks in advance for your help.
Maybe this.
Proof & syntax:
Function to get all dates from given range
Sample usage
If you just want to print the dates between two date in excel then my Suggestion is to you try below the code.
Here you have avoid the use of Loop that save the execution time.
you can simply convert the dated in long and make loop(+1) and get all dated between 2 dates(convert that to date again)
An array 'sn' containing all dates from 01-01-2015 to 15-01-2015. Msgbox introduced to illustrate the result.