ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formating X Axis on Chart using VBA (https://www.excelbanter.com/excel-programming/339244-formating-x-axis-chart-using-vba.html)

mozart[_6_]

Formating X Axis on Chart using VBA
 

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

--
mozar
-----------------------------------------------------------------------
mozart's Profile: http://www.excelforum.com/member.php...fo&userid=1331
View this thread: http://www.excelforum.com/showthread.php?threadid=40204


Peter T

Formating X Axis on Chart using VBA
 
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

"mozart" wrote in
message ...

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

I have done the following and get 'Object Does not Support this
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 With


--
mozart
------------------------------------------------------------------------
mozart's Profile:

http://www.excelforum.com/member.php...o&userid=13314
View this thread: http://www.excelforum.com/showthread...hreadid=402044





All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com