based current year...
i need to fill a combobox with the first day to last day for month may to september..
similar:
Private Sub APRI_PERIODI()
With Me.CPERIODI
.Clear
For K = 5 To 9
.AddItem first day of month & "-" & last day of month
Next K
End With
End Sub
and return:
01/05/2021-31/05/2021
01/06/2021-30/06/2021
...
01/09/2021-30/09/2021
LOOPING year and month
-
- 4StarLounger
- Posts: 536
- Joined: 27 Jun 2021, 10:46
Re: LOOPING year and month
Code: Select all
For k = 5 To 9
Debug.Print DateSerial(2021, k, 1) & "-" & DateSerial(2021, k + 1, 0)
Next
-
- PlatinumLounger
- Posts: 4334
- Joined: 26 Apr 2010, 17:36
Re: LOOPING year and month
WORK!SpeakEasy wrote: ↑06 Sep 2021, 12:32Code: Select all
For k = 5 To 9 Debug.Print DateSerial(2021, k, 1) & "-" & DateSerial(2021, k + 1, 0) Next
TKS.
-
- 3StarLounger
- Posts: 308
- Joined: 24 Dec 2015, 16:41
Re: LOOPING year and month
just a brief comment: as first day to last day for month may to september never changes
best practices would be to use a static table rather than rebuild each time... in terms of resource
best practices would be to use a static table rather than rebuild each time... in terms of resource