none
category axis display only date labels with data in vb RRS feed

  • Question

  • Hi,
    I have been going nuts reading through Google hits over the past few days and failed to find something that does what I need.
    I need to programmatically generate a chart with dates (1/1/2014 or whatever date format) in the category axis. I need the labels for that axis to only be displayed if there are values for those dates, but I also need the labels to be placed apart on a correct date scale so that dates that are closer in time are closer together on the axis, so the labels are not just text, but are interpreted a dates.
    here is what I'm playing with, on an xlLineMarkers chart (and sometimes xlXYScatterLines chart)
    .Axes(xlCategory).CategoryType = xlTimeScale 'this places the points on the chart, scaled appropriate to a date scale, i think
    .Axes(xlCategory).BaseUnit = xlDays  'i see that this makes the label display format in days (1/1/2014) rather than month (1/2014) or just year (2014)
    .Axes(xlCategory).MajorUnitScale = xlDays 'this makes the chart display labels for each day, but i find that it is the only way to include a label for a date with value but of course i then end up with a zillion other date labels that i do not need

    Am I out of luck on this one, with Excel?

    Thanks!
    Thursday, January 14, 2016 2:11 PM

All replies

  • Hi songwork,

    Could you provide the sample data with screenshot to introduce what the chart actual like and what you prefer to?

    Do you know how to do that manually? If so, please record macro and check the macro code in excel.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, January 15, 2016 6:17 AM
    Moderator