![]() |
Excel/VBA question: Link ChartTitle at run-time, anyone?
Using VBA and Excel I'm trying to link the ChartTitle of an embedded chart
to a cell, but I always get an runtime error. Do anyone know how to do this? Here is what I try to do: .ChartObjects(name).Chart.ChartTitle.Text = "=" & .Cells(row, 1).address (the . is a worksheet, name is the correct string and row is an nice integer..) K__t |
Excel/VBA question: Link ChartTitle at run-time, anyone?
Hi,
Try this, ..ChartObjects(1).Chart.ChartTitle.Text = _ "=" & ActiveCell.Parent.Name & "!" _ & ActiveCell.Address(ReferenceStyle:=xlR1C1) Knut Hollund wrote: Using VBA and Excel I'm trying to link the ChartTitle of an embedded chart to a cell, but I always get an runtime error. Do anyone know how to do this? Here is what I try to do: .ChartObjects(name).Chart.ChartTitle.Text = "=" & .Cells(row, 1).address (the . is a worksheet, name is the correct string and row is an nice integer..) K__t -- Cheers Andy http://www.andypope.info |
Excel/VBA question: Link ChartTitle at run-time, anyone?
"Andy Pope" wrote in message
... Hi, Try this, .ChartObjects(1).Chart.ChartTitle.Text = _ "=" & ActiveCell.Parent.Name & "!" _ & ActiveCell.Address(ReferenceStyle:=xlR1C1) Knut Hollund wrote: Using VBA and Excel I'm trying to link the ChartTitle of an embedded chart to a cell, but I always get an runtime error. Do anyone know how to do this? Here is what I try to do: .ChartObjects(name).Chart.ChartTitle.Text = "=" & .Cells(row, 1).address (the . is a worksheet, name is the correct string and row is an nice integer..) Thanks, for the answer, I didn't think about the reference style. The answer didn't solve my problem completely, but it made me test something I had tested before (External) and then suddenly I recognized that the title was blank.., ohh not again... As always when a bug is difficult to find, its a trivial error! Sorry to bother you all. Here is the code that solved my problem: ..ChartObjects(name).Chart.ChartTitle.Text = .Cells(row + 1, 1).address(External:=True, ReferenceStyle:=xlR1C1) (note the row+1 (grrr), and bytheway no need to activate anything) K__t |
All times are GMT +1. The time now is 12:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com