Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Charts forget range or data; fixed by manual alteration then Undo

G'day, everyone.

Two of my charts recently stopped displaying properly. When I refresh
the data behind them, the automatic X axis drops most of its range and
the chart either stops drawing most the ranges or collapses them to
<10% of their original size.

The most reliable way to prod the chart into displaying properly is to
make a manual alteration to the chart's configuration, and then hit
Undo. The changes themselves rarely help. Copying and pasting back to
the same range within the data can also help.

Weirdly, these tricks don't work when I run them as a macro. Here's
one I recorded. Whilst recording, it worked fine. On the replay, it
didn't.

Sub FixChartHack()
' Grotty hack to force the chart to refresh properly.
Sheets("Raw Perf Data").Select
Application.CutCopyMode = False
Selection.Copy
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

The charts are stacked charts of ten ranges, with data coming from one
sheet. I refresh the data from a VBA macro that deletes C:IY, then
insert-pastes C before itself enough times to stretch the range out to
its new size. That way, the chart stretches its own ranges without me
having to do it in code.

Set wSht = Sheets(SheetName)
With wSht
.Visible = True
.Activate
Columns("D:IV").Select
Selection.Delete Shift:=xlToLeft
Dim ColN As Integer
For ColN = 1 To AllDates.Count - 2
Columns("C:C").Select
Selection.Copy
Selection.Insert Shift:=xlToRight
Next
Cells(1, 1).Select
End With
' ... and then I shove numbers into the cells.

I'm running into this on Excel 2003, fully patched. Everything was
working fine for a few days I was working on the sheet, but now it's
abruptly stopped working. I can't ship the sheet until I can trust
that it'll reliably work for its users.

Could you give me a solid lead on how to work around this bug? How can
I force the chart to update itself properly?

Yours,
Garth.

  #2   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Charts forget range or data; fixed by manual alteration then Undo

Don't know if this will really help but I've found that using named ranges in
chart series saves a lot of headaches when you update the data.

Here's a sample: Note that the ranges might need to be re-named when
adjusted but I find it's easier to re-set a named range than trying to fix a
chart.

ActiveChart.SetSourceData Source:=Sheets("2-Cons").Range("ResNames," +
MonthN + ""), _
PlotBy:=xlColumns

HTH.

"Garth T Kidd" wrote:

G'day, everyone.

Two of my charts recently stopped displaying properly. When I refresh
the data behind them, the automatic X axis drops most of its range and
the chart either stops drawing most the ranges or collapses them to
<10% of their original size.

The most reliable way to prod the chart into displaying properly is to
make a manual alteration to the chart's configuration, and then hit
Undo. The changes themselves rarely help. Copying and pasting back to
the same range within the data can also help.

Weirdly, these tricks don't work when I run them as a macro. Here's
one I recorded. Whilst recording, it worked fine. On the replay, it
didn't.

Sub FixChartHack()
' Grotty hack to force the chart to refresh properly.
Sheets("Raw Perf Data").Select
Application.CutCopyMode = False
Selection.Copy
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

The charts are stacked charts of ten ranges, with data coming from one
sheet. I refresh the data from a VBA macro that deletes C:IY, then
insert-pastes C before itself enough times to stretch the range out to
its new size. That way, the chart stretches its own ranges without me
having to do it in code.

Set wSht = Sheets(SheetName)
With wSht
.Visible = True
.Activate
Columns("D:IV").Select
Selection.Delete Shift:=xlToLeft
Dim ColN As Integer
For ColN = 1 To AllDates.Count - 2
Columns("C:C").Select
Selection.Copy
Selection.Insert Shift:=xlToRight
Next
Cells(1, 1).Select
End With
' ... and then I shove numbers into the cells.

I'm running into this on Excel 2003, fully patched. Everything was
working fine for a few days I was working on the sheet, but now it's
abruptly stopped working. I can't ship the sheet until I can trust
that it'll reliably work for its users.

Could you give me a solid lead on how to work around this bug? How can
I force the chart to update itself properly?

Yours,
Garth.


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
Charts: using a filtered list as a data range DavidS New Users to Excel 0 November 20th 06 05:16 PM
Vlookup to Return a Range of Data James Excel Discussion (Misc queries) 0 July 13th 06 09:44 PM
Add a data series dynamically to a named range? Popeye Charts and Charting in Excel 3 March 10th 06 08:59 PM
Setting source data range with Charts D Charts and Charting in Excel 2 January 1st 06 02:51 AM
Charts not recognizing source data if original linked data is changed. JLC Charts and Charting in Excel 3 October 14th 05 01:29 AM


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

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"