View Single Post
  #1   Report Post  
Gary's Student
 
Posts: n/a
Default Automatically set chart axis labels from cell contents

I have lots of scatter charts plotting data in columns. At the top of each
column is a cell containing the label I want to appear on the axis. I would
like the axis to be re-labeled whenever the label cells change automatically.
I am currently doing this with a little macro:

Sub setlabel()
Dim x As String
x = Cells(1, 1)
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = x
End With
End Sub

This is not automatic. Is there a way to perform this automatically without
resorting to VBA trickery??
--
Gary's Student