Formating X Axis on Chart using VBA

  • Thread starter Thread starter mozart
  • Start date Start date
M

mozart

With great pains I am trying to format my x-axis values on a chart tha
I have created using vba.

I have done the following and get 'Object Does not Support thi
property or method error'.

StoreChart is my Chart Object.

Any help would be appreciated. Thanks

Worksheets(1).StoreChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End Wit
 
Try this (no need to select the chart or axis)

Sub test()
Dim ch As Chart
Set ch = ActiveSheet.ChartObjects("StoreChart").Chart
With ch.Axes(xlValue).TickLabels
.AutoScaleFont = True
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End With
End Sub

Regards,
Peter T
 

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

Back
Top