Customize axis scale

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
 
D

Debra Dalgleish

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?
 
F

Felipe I

It worked!

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top