ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Setting Y axis display labels (https://www.excelbanter.com/charts-charting-excel/119311-setting-y-axis-display-labels.html)

Barb Reinhardt

Setting Y axis display labels
 
What am I doing wrong he

For Each chtobj In aWS.ChartObjects
Debug.Print chtobj.Name
With chtobj
With chtobj.Axes
If Power <= 2 Then
.displayunits = "Hundreds"
ElseIf Power <= 3 Then
.displayunits = "Thousands"
ElseIf Power <= 6 Then
.displayunits = "Millions"
ElseIf Power <= 9 Then
.displayunits = "Billions"
ElseIf Power <= 12 Then
.displayunits = "Trillions"
End If
End With
End With
Next chtobj


I'm just guessing on .displayunits because I haven't been able to find any
reference for it.

Andy Pope

Setting Y axis display labels
 
Hi,

Your not referencing the actual chart.

Amend your code. Also the second with does not require the chtobj.

For Each chtobj In aWS.ChartObjects
Debug.Print chtobj.Name
With chtobj.chart
With .Axes
If Power <= 2 Then

Cheers
Andy

Barb Reinhardt wrote:
What am I doing wrong he

For Each chtobj In aWS.ChartObjects
Debug.Print chtobj.Name
With chtobj
With chtobj.Axes
If Power <= 2 Then
.displayunits = "Hundreds"
ElseIf Power <= 3 Then
.displayunits = "Thousands"
ElseIf Power <= 6 Then
.displayunits = "Millions"
ElseIf Power <= 9 Then
.displayunits = "Billions"
ElseIf Power <= 12 Then
.displayunits = "Trillions"
End If
End With
End With
Next chtobj


I'm just guessing on .displayunits because I haven't been able to find any
reference for it.



All times are GMT +1. The time now is 10:49 PM.

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