Based the month(date) and year(date), how to list the days of a block of 3 month...for example:
month(date) August
year(date) 2022
list the days of
August
September
October
01/08/2022
...
30/10/2022
===============
month(date) January
year(date) 2022
list the days of
January
February
March
01/01/2022
...
31/03/2022
LIST DAYS
-
- Administrator
- Posts: 79370
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: LIST DAYS
Do you want to input the month by its name (August or Agosto), or by its number (8)?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4481
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 79370
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: LIST DAYS
Perhaps you can use this as a starting point.
Code: Select all
Sub ListDates()
Dim ANNO As Long
Dim MESE As Long
Dim DATO As Date
ANNO = 2022
MESE = 8
For DATO = DateSerial(ANNO, MESE, 1) To DateSerial(ANNO, MESE + 3, 0)
' Do something with DATO, for example
Debug.Print DATO
Next DATO
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4481
- Joined: 26 Apr 2010, 17:36
Re: LIST DAYS
HansV wrote: ↑10 Aug 2022, 14:59Perhaps you can use this as a starting point.
Code: Select all
Sub ListDates() Dim ANNO As Long Dim MESE As Long Dim DATO As Date ANNO = 2022 MESE = 8 For DATO = DateSerial(ANNO, MESE, 1) To DateSerial(ANNO, MESE + 3, 0) ' Do something with DATO, for example Debug.Print DATO Next DATO End Sub