An implementation of Visual Basic that is built into Microsoft products.
I had a similar issue:
- a chart-axis that would not accept VBA generated date-values, eg "21-aug-2020" caused the axis to default to text-mode
- a calculated array of date-values that looked good as long as the day-of-the-month was no bigger than 12
The problem occurs when VBA hands over "date"-values to Excel. I think it is a bug...
My solution is to avoid the "date" data-type for this hand-over:
- do the calculations with "date"-functions such as DateAdd in VBA when needed
- convert the values using CDBL (if the time is relevant) or CLNG (if only the date is relevant)
- move the converted values to Excel, (I store the array in a variant and write that to a Range)
- format the cells as "date" in Excel. This can be done in advance, or afterward!
This worked for both my problems.
With the Chart I used the Long-values to populate the category-axis and then set the axis-type to "date".