dynamic range

G

geebee

hi,

i have the following:

Dim NewGraphSource As String
Dim testRange As Range
testRange = NewGraphSource
MsgBox "testrange: " & testRange
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Trending").Range(testRange) _
, PlotBy:=xlRows


lets just say that NewGraphSource = A14:G14

i am getting an error message:
"runtime error 91: object variable or With block variable not set"

i am not sure what to do.

thanks in advance,
geebee
 
G

Gary''s Student

You are very close:

Dim NewGraphSource As String
Dim testRange As Range
NewGraphSource = "A14:G14"
Set testRange=Range(NewGraphSource)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top