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)
|