PC Review


Reply
Thread Tools Rate Thread

Charts.Add - Smart, But Oh So Dumb

 
 
Spiggy Topes
Guest
Posts: n/a
 
      17th Dec 2009
Here's the scenario, in Excel 2007 (of course)I have a sheet with 365
rows, 253 columns. I have a macro that's going to build a chart based
on SOME of those columns. My code says

Set oActChart = Charts.Add

Used to work just fine in Excel 2003, now it takes 2.5 minutes and
sucks up half a gig of memory, because it thinks I want to chart
everything on the data sheet. I can get around this by selecting a
small range on the data sheet, but I'd far prefer to be able to tell
Excel not to try to anticipate what I want to do. Is there any simple
way - other than that above - to do this?
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      18th Dec 2009
Maybe something like this

Sub test()
Dim rSource As Range, rCol As Range
Dim cht As Chart
Dim sr As Series

Set rSource = ActiveSheet.Range("A110")

Call getNewChart(cht)
cht.SetSourceData rSource

' add more series and format the chart, eg
' Set sr = cht.SeriesCollection.NewSeries
' etc

End Sub

Sub getNewChart(chtSht As Chart)
Dim rOrig As Range
Set rOrig = ActiveWindow.VisibleRange
Application.EnableEvents = False
With ActiveSheet
Application.Goto .Cells(rOrig.Row, .Cells.Columns.Count), True
Set chtSht = Charts.Add
End With
Application.Goto rOrig(1), True

chtSht.Activate
Application.EnableEvents = True
End Sub

point being, ensure the activecell is empty and not part of some other
larger current-region.

Regards,
Peter T

"Spiggy Topes" <(E-Mail Removed)> wrote in message
news:d255fb05-94db-46c9-bc87-(E-Mail Removed)...
> Here's the scenario, in Excel 2007 (of course)I have a sheet with 365
> rows, 253 columns. I have a macro that's going to build a chart based
> on SOME of those columns. My code says
>
> Set oActChart = Charts.Add
>
> Used to work just fine in Excel 2003, now it takes 2.5 minutes and
> sucks up half a gig of memory, because it thinks I want to chart
> everything on the data sheet. I can get around this by selecting a
> small range on the data sheet, but I'd far prefer to be able to tell
> Excel not to try to anticipate what I want to do. Is there any simple
> way - other than that above - to do this?



 
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
EXCEL CHARTS: Smart Tags Shevvie Microsoft Powerpoint 0 30th May 2008 08:36 AM
Word 2007 'Smart' quotation marks being dumb...help! Tony Butcher Microsoft Word Document Management 2 16th Dec 2007 03:37 PM
Smart charts. Is it possible? kras Microsoft Excel Misc 1 24th Aug 2006 02:30 AM
what is a dumb or smart formula =?Utf-8?B?ZGVkZQ==?= Microsoft Excel Worksheet Functions 6 16th Oct 2005 11:57 AM
smart charts =?Utf-8?B?RGF2ZSBCcmVpdGVuYmFjaA==?= Microsoft Excel Charting 2 27th Jun 2005 02:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:03 AM.