Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 72
Default Error message when adding a name

I get the following errors when trying to add a name to a chart using my macro.
Code copied directly from recorded macro
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=A1"

run-time error 1004
Application defined or object-defined error.
Why is it not working?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 340
Default Error message when adding a name

Try this instead:

ActiveChart.SeriesCollection(1).Name = _
"=" & Range("a1").Address(external:=True, _
ReferenceStyle:=xlR1C1)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"matelot" wrote in message
...
I get the following errors when trying to add a name to a chart using my
macro.
Code copied directly from recorded macro
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=A1"

run-time error 1004
Application defined or object-defined error.
Why is it not working?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 72
Default Error message when adding a name

Bob,
It works. Do you know why the macro that Excel output from the recorded
macro doesn't work? Just out of curiosity.

Thanks
Mat

"Bob Flanagan" wrote:

Try this instead:

ActiveChart.SeriesCollection(1).Name = _
"=" & Range("a1").Address(external:=True, _
ReferenceStyle:=xlR1C1)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"matelot" wrote in message
...
I get the following errors when trying to add a name to a chart using my
macro.
Code copied directly from recorded macro
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=A1"

run-time error 1004
Application defined or object-defined error.
Why is it not working?

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Error message when adding a name

The macro recorder isn't perfect. What you need to remember is that the
chart isn't part of the worksheet, even though it may be embedded on it. So
any reference to the sheet has to be explicitly stated. So enter
=Sheet1!$A$1 instead.

In fact, in Excel 2003, the macro recorder recorded this:

ActiveChart.SeriesCollection(1).Name = "=Sheet1!R1C1"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"matelot" wrote in message
...
Bob,
It works. Do you know why the macro that Excel output from the recorded
macro doesn't work? Just out of curiosity.

Thanks
Mat

"Bob Flanagan" wrote:

Try this instead:

ActiveChart.SeriesCollection(1).Name = _
"=" & Range("a1").Address(external:=True, _
ReferenceStyle:=xlR1C1)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"matelot" wrote in message
...
I get the following errors when trying to add a name to a chart using my
macro.
Code copied directly from recorded macro
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=A1"

run-time error 1004
Application defined or object-defined error.
Why is it not working?

Thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding more than 3 cells (2003)produces "0" but no error message garden girl Excel Worksheet Functions 4 August 30th 06 02:11 PM
Adding an error message at close of file when criteria are met Dave Excel Discussion (Misc queries) 3 August 12th 05 07:56 PM
VBA Error Message "Compile Error...." Steve Excel Discussion (Misc queries) 3 July 15th 05 09:20 AM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"