Hello,
I'd like to change the x-axis with values from the table to generate a Gantt chart.
I have no problems to create a chart with for example a range from calendar week 20-51.
I have added some rows to help me to scale the axis (J7 and J9 / K7 and K9).
In those cells, I search for the lowest and highest date and change it to a calendar week.
I also changed the numberFormat to "0 KW" KW means calendar week in German.
It is working in a range of one year, but as soon as I switch to another year it plots the graph wrong (the reason is obvious week: 42 - 15 makes no sense with this logic right now).
Is there a way to combine week and year and use this to plot the axis (with VBA, because it should be done automatic every time)?
Sadly I can't add files here, one is working because the range is in between (picture 1 and 2) 1-52 and the other isn't working because it switches from 2016-2017-2018 (picture 3 and 4).
http://imageshack.com/a/img923/2558/K5iOcC.png
http://imageshack.com/a/img924/1200/FOQyuy.png
http://imageshack.com/a/img924/1591/FIwvtS.png
http://imageshack.com/a/img922/3849/5DFpbn.png
Additional information:
- Rows A:I are automatically generated (don't touch those please)
- I can add as many "helping" rows as I want.
- Files are in German, VBA in English, if you don't understand something then ask me.
Kind regards,
Niko
I'd like to change the x-axis with values from the table to generate a Gantt chart.
I have no problems to create a chart with for example a range from calendar week 20-51.
Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">chtChart.Axes(xlValue).MinimumScale = Sheets("Sheet1").Range("J9")
chtChart.Axes(xlValue).MaximumScale = Sheets("Sheet1").Range("K9")
chtChart.Axes(xlValue).MajorUnit = Sheets("Sheet1").Range("L9")
</code>
I have added some rows to help me to scale the axis (J7 and J9 / K7 and K9).
In those cells, I search for the lowest and highest date and change it to a calendar week.
I also changed the numberFormat to "0 KW" KW means calendar week in German.
Code:
[COLOR=#333333][FONT=monospace]chtChart.Axes(xlColumns).TickLabels.NumberFormat = "0 KW"[/FONT][/COLOR][COLOR=#333333]
[/COLOR]
It is working in a range of one year, but as soon as I switch to another year it plots the graph wrong (the reason is obvious week: 42 - 15 makes no sense with this logic right now).
Is there a way to combine week and year and use this to plot the axis (with VBA, because it should be done automatic every time)?
Sadly I can't add files here, one is working because the range is in between (picture 1 and 2) 1-52 and the other isn't working because it switches from 2016-2017-2018 (picture 3 and 4).
http://imageshack.com/a/img923/2558/K5iOcC.png
http://imageshack.com/a/img924/1200/FOQyuy.png
http://imageshack.com/a/img924/1591/FIwvtS.png
http://imageshack.com/a/img922/3849/5DFpbn.png
Additional information:
- Rows A:I are automatically generated (don't touch those please)
- I can add as many "helping" rows as I want.
- Files are in German, VBA in English, if you don't understand something then ask me.
Kind regards,
Niko