Rbx01x
Rbx01x

Reputation: 11

VBA: Hard Coding Dates to X axis in Date format

I'm having a problem with adding dates to a scatter chart. I'm using a string to add values to a chart's series collection (e.g.: Chart1.FullSeriesCollection(1).XValues = {date1,date2,date3})

It works great when I format the dates to a number value (e.g.: Format(xDate, "0"), but the X axis shows up as numbers instead of dates.

However, it does NOT work when the dates are left in date format (e.g.: Format(xDate, "MM/DD/YY").

I also tried ("#" & Format(xDate, "MM/DD/YY") & "#") to no avail.

Any Ideas? Hoping it's simple, and I'm just tired from working on my algorithm all day.

Upvotes: 0

Views: 1273

Answers (1)

Rbx01x
Rbx01x

Reputation: 11

Formatted the X axis 'Number' to Category: Date (format code: "mm/dd/yyy"), and viola! The chart changes the date number values to the format I wanted to see.

Upvotes: 1

Related Questions