SereneSea
New Member
- Joined
- Feb 2, 2022
- Messages
- 43
- Office Version
- 2016
- Platform
- Windows
Hello again VBA Neebie here,
I have another question now. I have a ganntt chart that I would like the x-axis to change with what is in cells H3 and I3. My minimum date start is in H3 and maximum is in I3.
If its possible to have the chart updated as soon as someone enters the dates?
I tried this code but I am getting an automation and unspecified error.
I have another question now. I have a ganntt chart that I would like the x-axis to change with what is in cells H3 and I3. My minimum date start is in H3 and maximum is in I3.
If its possible to have the chart updated as soon as someone enters the dates?
I tried this code but I am getting an automation and unspecified error.
VBA Code:
Sub ScaleXAxisWholeCycle()
Dim Ch As Chart
On Error Resume Next
Set Ch = ActiveChart
On Error GoTo 0
If Not Ch Is Nothing Then
With ActiveChart.Axes(xlCategory, xlPrimary)
.MinimumScale = ActiveSheet.Range("H3").Value
.MaximumScale = ActiveSheet.Range("I3").Value
End With
Else
MsgBox "No Chart Found"
End If
End Sub