Chart axis title, Formula, and VBA

mikejvir

Board Regular
Joined
Jan 3, 2008
Messages
95
Hello,

I have an issue which I have not found a solution for. I have a chart that links the axis titles to a cell in worksheet tab (=Data!$A$6). I also need to reset the axis title for alignment (long issue). The code I have is


Code:
Dim  Axs As Long
Dim AxSide As Long
Dim Tstring As String

  With ActiveChart.Axes(Axs, AxSide)
    If .HasTitle = False Then
      .HasTitle = True
    Else                                '  Need to reset title
      Tstring = .AxisTitle.Caption
      If Tstring = "" Then Tstring = "Axis"
      .HasTitle = False
      .HasTitle = True
      .AxisTitle.Characters.Text = Tstring
    End If
  End With

The problem is with
Code:
Tstring = .AxisTitle.Caption
since it only captures the text, not the formula. I can not determine the object to read. There may also me an issue with how I write to it
Code:
.AxisTitle.Characters.Text = Tstring
.

Thanks for your help.
Mike Virostko
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hello,

I posted this question last year. Since there is not been an answer, either there is no solution or I did not explain it correctly.

Any help?

Mike Virostko
 
Upvote 0
It looks like you want AxisTitle.Formula rather than Caption.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top