![]() |
Problem with VBA code and Range
That did the trick! Thanks so much for the help. I'm using XL2007, but a friend (who still uses XL2003) was trying to help out, which is where the 2003 code might likely have come from.
If I wanted to customize the ChartTitle to the value in column D, would that just be: ..ChartTitle.Characters.Text = "=Sheets(shName).$D$" & i I tried this, and got "shName$D$1" as the title. Thanks! Jeff |
Problem with VBA code and Range
"Jeffrey Marks" wrote:
That did the trick! Thanks so much for the help. Glad to hear it worked well for you. Jeffrey wrote: If I wanted to customize the ChartTitle to the value in column D, would that just be: .ChartTitle.Characters.Text = "=Sheets(shName).$D$" & i Try: ..ChartTitle.Characters.Text = Sheets(shName).Range("D" & 2+i) Remember that "i" is an offset starting at zero. I am guessing that the title start in D2, just as the data starts in F2:K2. Better.... Sub OATChartCreate() Dim i As Integer, shName As String Dim rowData As Range, rowXAxis As Range Dim chtTitle as Range '***add*** ' *** CUSTOMIZE *** shName = "OAT Test Charts Dtat_Crosstab" Set rowData = Sheets(shName).Range("f2:k2") Set rowXAxis = Sheets(shName).Range("f1:k1") Set chtTitle = Sheets(shName).Range("d2") '***add*** [....] .ChartTitle.Characters.Text = chtTitle.Offset(i,0) |
All times are GMT +1. The time now is 01:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com