LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Chart disappearing in Excel 07 but not in 03

In a sheet I have a base chart with a line graph of 26 countries. In range
U15:U40 the countries are listed with a simple data validation drop-down box
"Include/Exclude" right next to it. The moment a country is included or
excluded, a macro should run te recreate the chart by deleting the chart
which is on screen (which is, of course, not the base chart) and copying the
base chart to the top of the sheet (range B8, where the other chart is just
deleted). After that, all countries in the new chart should be deleted if
they are excluded.

The macro I wrote works in Excel 2003 and 2007 when more than 1 country is
included. If only one country is included it still works (a bit differently
!?) in 2003, but the chart area disappears in 2007

I have the following code :

Private Sub Worksheet_Change(ByVal Target As Range)
.........
If Target = "Include" Or Target = "Exclude" Then

Worksheets("Globals").Unprotect Password:="xxxxx"
Sheets("Globals").Range("ChangeMode").Value = False

Call GraphChange

Sheets("Globals").Range("ChangeMode").Value = True
Worksheets("Globals").Protect Password:="xxxxx"

End If
Sub GraphChange()

ActiveWindow.Zoom = 100
ActiveSheet.ChartObjects("Graph02").Activate
ActiveWindow.Visible = False
Selection.Delete
ActiveSheet.ChartObjects("Graph02Base").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
Windows("Consolidation.xls").Activate
Range("B8").Select
ActiveSheet.Paste
Range("Graph02_Date_choice").Select
ActiveSheet.ChartObjects(2).Name = "Graph02"

Dim x As Integer
Dim z As Integer
Dim CheckRange As String

x = 15
z = 0

For y = 1 To 26

CheckRange = "V" & x

If Range(CheckRange).Value = "Exclude" Then

ActiveSheet.ChartObjects("Graph02").Activate
ActiveChart.SeriesCollection(y - z).ChartType = xlColumnClustered
ActiveChart.SeriesCollection(y - z).Delete

z = z + 1

End If

x = x + 1

Next y

Range("Graph02_Zoom").Select
ActiveWindow.Zoom = True

End Sub
------------------------------------------------------------------------------------------
Anyone a clue?

Regards,

Henk




 
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
Excel 2007: disappearing chart sheets! Dallman Ross Setting up and Configuration of Excel 2 December 15th 09 11:19 PM
Disappearing Data Label in chart Meenie Charts and Charting in Excel 1 October 28th 09 01:17 PM
Disappearing Chart Worksheet Names wiubiblio Excel Discussion (Misc queries) 1 July 24th 08 04:13 PM
Disappearing chart swhight Charts and Charting in Excel 0 October 12th 07 05:16 AM
Disappearing Chart Axis Richard Charts and Charting in Excel 4 September 15th 05 03:49 PM


All times are GMT +1. The time now is 02:46 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"