Monday 26 August 2019

vba - Link Excel Chart Axis Scale to Values in Cells

I have this Gantt Chart and i'm looking at Planned Vs Actual dates.
the problem is that the chart wont sync the start/end date.



i'm trying to link the max/min values to the cell with VBA but it wont to it.



I tried to use this site:
https://peltiertech.com/link-excel-chart-axis-scale-to-values-in-cells/



but his code doesn't work for my chart.




here is a picture:
enter image description here



the dates MUST be the same, and change together if i change some values in the table on the right
any ideas?
thanks



Private Sub Worksheet_Change(ByVal Target As Range)
With ActiveSheet.ChartObjects("Chart 2").Chart
Select Case Target.Address


Case "$G$161"
.Axes(xlCategory).MaximumScale = Target.Value

Case "$F$163"
.Axes(xlCategory).MinimumScale = Target.Value

Case "$G$161"
.Axes(xlValue).MaximumScale = Target.Value


Case "$F$163"
.Axes(xlValue).MinimumScale = Target.Value

End Select
End With
End Sub

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...