ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Axis label that corresponds to cell (https://www.excelbanter.com/excel-discussion-misc-queries/54602-axis-label-corresponds-cell.html)

pete3589

Axis label that corresponds to cell
 

I have an interactive graph which graphs data from a set column. This
column changes depending on what is selected on a list selector. I was
wondering if there is a way to label the y axis whatever was in, say
cell AD11.

I was hoping that that this would be something easy that I could write
into the excel chart wizard, like =$AD$11, but it is not. Any help
would be appreciated.


--
pete3589
------------------------------------------------------------------------
pete3589's Profile: http://www.excelforum.com/member.php...o&userid=28402
View this thread: http://www.excelforum.com/showthread...hreadid=483691


Rowan Drummond

Axis label that corresponds to cell
 
Assuming the chart is an embeded object on the sheet and is called
"Chart 1" then this will change the Y axis title every time AD11 is changed:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim chrt As ChartObject
Dim axs As AxisTitle
If Target.Address = "$AD$11" Then
Set chrt = Me.ChartObjects("Chart 1")
Set axs = chrt.Chart.Axes(xlValue).AxisTitle
axs.Characters.Text = Target.Value
End If
End Sub

This is worksheet event code. Right click the sheet tab, select View
Code and paste the code in there.

Hope this helps
Rowan

pete3589 wrote:
I have an interactive graph which graphs data from a set column. This
column changes depending on what is selected on a list selector. I was
wondering if there is a way to label the y axis whatever was in, say
cell AD11.

I was hoping that that this would be something easy that I could write
into the excel chart wizard, like =$AD$11, but it is not. Any help
would be appreciated.



pete3589

Axis label that corresponds to cell
 

Yes it did. Thank you Rowan


--
pete3589
------------------------------------------------------------------------
pete3589's Profile: http://www.excelforum.com/member.php...o&userid=28402
View this thread: http://www.excelforum.com/showthread...hreadid=483691


Rowan Drummond

Axis label that corresponds to cell
 
You're welcome.

pete3589 wrote:
Yes it did. Thank you Rowan




All times are GMT +1. The time now is 01:33 PM.

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