Customize axis scale

  • Thread starter Thread starter Felipe
  • Start date Start date
F

Felipe

I have a spreadsheet with dates and data to be graphed for
each date. I would like to customize the x-axis(time)
scale without having to edit the chart. The graph will be
used and seen by many users, so I would like the user to
input the initial and final dates in cells so the scale is
automaticaly updated.

I tried writing a macro for this and asigning it to a
botton, but I get an error in the following line:
.MinimumScale = Range("E2").Value

E2 is the celll where the user inputs initial date.

I would apreciate help with the VBA code, and would like
to know if you can think of a simpler way to do this.

Thanks for your help,
Felipe
 
The following code, run from a command button, worked:

Sub ChangeScale()
ActiveSheet.ChartObjects(1).Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = Range("E2").Value
End With
End Sub

Are you sure that the value in cell E2 is a valid date?
What error are you getting?
 
It worked!

Thank you very much ... I still don´t know what I was
doing wrong though...
 
Back
Top