PDA

View Full Version : Solved: macro to update chart axis



klutz
03-14-2011, 07:51 AM
Hello

I have a chart in excel that is used as a timeline. When I start a new task I have to format the X axis on the Chart manually to the dates I choose.

Can someone help me with a macro that can copy the START and END date from a field in the file and update the chart?

I tried recording a macro with the same steps, it works initially except that when I changed the dates and ran the macro to update the new dates the X axis did not changed, it kepted the old dates.:dunno

Thanks-

klutz
03-14-2011, 08:06 AM
OK. I got it to work nicely while searching the web..

Thanks to those who viewed my post...

This is the code..


ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScale = Range("n1").Value -----' this is where the values are'
.MaximumScale = Range("n2").Value-----' this is where the values are'
.MinorUnit = 1
.MajorUnit = 1
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With