PC Review


Reply
Thread Tools Rate Thread

Can not get Excel macros to format/save charts--help??? :(((((

 
 
AccessQuestion
Guest
Posts: n/a
 
      18th Mar 2010
Help??(( I've spent the last 5 days searching on this forum for problems
similar to what I have but no luck! I am trying to use Excel macro to create
a simple bar chart and to format the chart type/etc...but the macro keeps
erroring when I try to run it.
The debug points to "
'
Set ActiveChart = ActiveSheet.ChartObjects(Chart1)" run time error 1004.
No matter what I name the chart, it errors.
I'm advanced at Excel but not editing macros with VB.
I'm at my wits end and hope that someone can help me (



 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      19th Mar 2010
Hi,

You do not set the Activechart object in that way. It is automatically
assigned by activating the chart.

Activesheet.chartobjects("Chart 1").activate

Now you can use the Activechart object, for example.

Msgbox "Chart has " & Activechart.seriescollection.count & " series"

Cheers
Andy

On 18/03/2010 21:04, AccessQuestion wrote:
> Help??(( I've spent the last 5 days searching on this forum for problems
> similar to what I have but no luck! I am trying to use Excel macro to create
> a simple bar chart and to format the chart type/etc...but the macro keeps
> erroring when I try to run it.
> The debug points to "
> '
> Set ActiveChart = ActiveSheet.ChartObjects(Chart1)" run time error 1004.
> No matter what I name the chart, it errors.
> I'm advanced at Excel but not editing macros with VB.
> I'm at my wits end and hope that someone can help me (
>
>
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

 
Reply With Quote
 
AccessQuestion
Guest
Posts: n/a
 
      22nd Mar 2010
Hi Andy,
Thanks for your answer but I'm not sure I understand.
This is my code and the debugger keeps stopping on ActiveChart.SetSourceData
line.


'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
' ActiveChart.SetSourceData



--
mfg2529


"Andy Pope" wrote:

> Hi,
>
> You do not set the Activechart object in that way. It is automatically
> assigned by activating the chart.
>
> Activesheet.chartobjects("Chart 1").activate
>
> Now you can use the Activechart object, for example.
>
> Msgbox "Chart has " & Activechart.seriescollection.count & " series"
>
> Cheers
> Andy
>
> On 18/03/2010 21:04, AccessQuestion wrote:
> > Help??(( I've spent the last 5 days searching on this forum for problems
> > similar to what I have but no luck! I am trying to use Excel macro to create
> > a simple bar chart and to format the chart type/etc...but the macro keeps
> > erroring when I try to run it.
> > The debug points to "
> > '
> > Set ActiveChart = ActiveSheet.ChartObjects(Chart1)" run time error 1004.
> > No matter what I name the chart, it errors.
> > I'm advanced at Excel but not editing macros with VB.
> > I'm at my wits end and hope that someone can help me (
> >
> >
> >

>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not get Excel macros to save chart format -lost in space! AccessQuestion Microsoft Excel Charting 5 19th Mar 2010 02:38 PM
Macros to Link Ranges and Charts from Excel 2007? mucrick Microsoft Powerpoint 0 12th Mar 2009 09:08 PM
Re: Save charts in a Excel file into another new one Jon Peltier Microsoft Excel Programming 5 5th Aug 2005 12:53 PM
Excel Charts(Graphs) & Macros =?Utf-8?B?Sm9obg==?= Microsoft Excel Misc 4 7th Jul 2005 09:26 PM
Macros, Charts & Excel 2003 =?Utf-8?B?RGF2aWQgSC4=?= Microsoft Excel Worksheet Functions 0 15th Oct 2004 06:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:55 PM.