Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Charts.Add - Smart, But Oh So Dumb

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Charts.Add - Smart, But Oh So Dumb

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("A1:D10")

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" wrote in message
...
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
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
Working with Smart Art Graphics, Sheets, and Charts meliscarm Excel Discussion (Misc queries) 0 September 26th 08 07:11 PM
Smart charts. Is it possible? kras Excel Discussion (Misc queries) 1 August 24th 06 02:30 AM
what is a dumb or smart formula dede Excel Worksheet Functions 6 October 16th 05 11:57 AM
Dumb question of the day. DennisB Excel Programming 5 September 12th 05 03:21 AM
smart charts Dave Breitenbach Charts and Charting in Excel 2 June 27th 05 02:15 AM


All times are GMT +1. The time now is 08:35 PM.

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

About Us

"It's about Microsoft Excel"