Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Day Of Month History Table

Status
Not open for further replies.

cfash

Programmer
Nov 22, 2000
8
US
I don't know if this is even possible, but let me know if you have any suggestions.

Does anyone know a way in which I could figure out the last date in every month for the last ten years. I need to have this data for a calendar table I am trying to create.

Any suggestions are appreciated.

Chris
 
if you just want the dates then
In excel just type in 1/31/1991 then in the next row type 2/28/1991 then drag letting autofill do the rest
otherwise use dateadd() and add a month to the last date of each month
something like
Dim x As Integer
For x = 0 To 120
Debug.Print DateAdd("m", x, "31-Jan-91")
Next x
 
Just a small nit pick, but ten years (starting w/ 0) is only 119 months. Also, depending on the desired ordering, you could Start with the current (or previous) month end) and use "-x" as the number of units to add.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top