Hi
I have worked out a rudimentary system to change data source for a template chart via macro buttons. When I use though I lose my Category(X)axis labels which should be set as a named range TITLES.
I have tried umpteen inserts into code below but cannot hit on the one I need to always format the x axis labels.
Ant assistance appreciated
Rgds Nigel. Attached code used
Sub Button3_Click()
Dim cht As ChartObject
Dim rng As Range
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Range("=CHART_01")
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "FUEL CONSUMPTION 01/02 TRUCKS"
'ActiveChart.HasAxes = True
'ActiveChart.Axes Source:=Range("=Titles")
Category(X).AxisLabels = Range("Titles")
'ActiveChart.PrintPreview
Dim Ans As Long
Ans = MsgBox("DO YOU WISH TO PRINT ?", vbYesNo)
If Ans = vbYes Then
ActiveChart.PrintOut Copies:=1, Collate:=True
ElseIf Ans = vbNo Then
End If
End Sub
Bookmarks