• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

VBA Scatter Chart X-Axis Category Minimum Scale Syntax

The sub 'but' below runs fine
However, the 'however' sub does ok on the Name line, and run-time errors 438 on the Axes line, claiming "Object doesn't support property..."
The charts are all xy Scatter.
Please advise.

Sub but()
For Each Chrt In ActiveSheet.ChartObjects
Chrt.Activate
Debug.Print ActiveChart.Name, ActiveChart.Axes(xlCategory).MinimumScale
Next
End Sub

Sub however()
For Each Chrt In ActiveSheet.ChartObjects
Debug.Print Chrt.Name
Debug.Print Chrt.Axes(xlCategory).MinimumScale
Next
End Sub

Regards
Brian
0
canesbr
Asked:
canesbr
1 Solution
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

try

Sub however()
For Each Chrt In ActiveSheet.ChartObjects
Debug.Print Chrt.Name
Debug.Print Chrt.Chart.Axes(xlCategory).MinimumScale
Next
End Sub

Open in new window


You need to address the chart object. In the but() you do that with the ActiveChart. In the however() you need Chrt.Chart to address the chart properly.

cheers, teylyn
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now