Name
axis
.CategoryNames [= setting
]
Synopsis
Sets or returns the array of data used by the category axis. For example, the following code changes the names on the category axis:
Sub SetCategoryNames( ) Dim chrt As Chart, ax As Axis Set chrt = ActiveSheet Set ax = chrt.Axes(xlCategory, xlPrimary) ax.CategoryNames = Array("this", "that", "the", "other") End Sub
Warning
Setting an individual element of this array may crash Excel:
ax.CategoryNames(1) = "foo" ' Crash!
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.