Use the name of the sheet that holds the name, and use syntax like this:
ActiveChart.SeriesCollection(1).XValues = "='" & ActiveSheet.Name &
"'!TheRange"
Excel will fill in the appropriate local or global scope for the name
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______
"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
> Your error description suggests you are running the code without actually
> selecting a chart, or maybe you've just created a chart that doesn't yet
> have a series. Beyond that the the syntax is not quite right
>
> s = "='" & ActiveWorkbook.Name & "'!" & "Beginning_Timer"
> s = "=Beginning_Timer"
> ActiveChart.SeriesCollection(1).XValues = s
>
> Obviously ensure a chart is active. Presumably the defined name is in the
> same workbook, otherwise change ActiveWorkbook.Name to "myBook.xls" But if
> working with a worksheet (local) name change use sheet-name.
>
> Regards,
> Peter T
>
>
>
>
>
>
> "Matt S" <(E-Mail Removed)> wrote in message
> news:AE29AFAB-13DF-4AC8-B390-(E-Mail Removed)...
>>I have a few ranges that are named within Excel. I'd like to chart my
>> Beginning_Timer range against my Temp_Ramp range with a XY Scatter plot.
>>
>> If I put ActiveChart.SeriesCollection(1).XValues = "=Beginning_Timer"
>> it gives me an error '91' Object variable or With Block variable not set.
>>
>> Help?
>> <3 Matt
>
>