Av8tordude
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 1,075
- Office Version
- 2019
- Platform
- Windows
I have this code that populates ten years before and 10 years after the current year, however I have various dates starting from column D15 that I would like to only show the range of years in the column. For example, If the first date is 03/02/2013 and the last date is 12/01/2018, I would like to only show the years 2013 - 2018. Can someone assist with my request.
Thank you kindly
Code:
For i = -10 To 10
If i = 1 Then cbYr.AddItem Format((Date), "yyyy") _
Else: cbYr.AddItem Format((DateAdd("yyyy", (i - 1), Date)), "yyyy")
Next
Thank you kindly
Last edited: