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: 1
Default Chart is being dumped into the wrong sheet

Hi Experts

I trying to create a chart in one of my sheets by running a macro. Th
macro runs fine and creates the chart, but keeps putting the chart int
the first sheet. It should actually be placed as an object in the shee
where the source data is found. This is the code generated by th
macro:


Code
-------------------
Range("A14:H16").Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Brands by Brand").Range("A14:H16") _
, PlotBy:=xlRows
ActiveChart.Location Whe=xlLocationAsObject, Name:="Brands by Brand"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Qty of Tyres Sold"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlBottom
ActiveSheet.Shapes("Chart 1").IncrementLeft -84.75
ActiveSheet.Shapes("Chart 1").IncrementTop 131.25
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 5
.Pattern = xlSolid
End With
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 19
.Pattern = xlSolid
End With

-------------------


Am I right in assuming that this line: "ActiveChart.Locatio
Whe=xlLocationAsObject, Name:="Brands by Brand"" indicates where th
chart should be stored?

On the other hand when I run the macro and create the graph, the las
step is to decide if it should be stored as an object in the curren
sheet or dumped into it's own sheet. This procedure is not being picke
up so the chart ends up being dumped into the first sheet.

Any help you can provide would be highly appreciated.

Kind Regard

--
Message posted from http://www.ExcelForum.com

 
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
data in the chart is wrong Jaymee Charts and Charting in Excel 3 February 5th 08 11:03 PM
Dates appear wrong in my chart Rockman Charts and Charting in Excel 1 January 11th 08 11:46 PM
Vlookup-Wrong Sheet! BB New Users to Excel 9 August 5th 07 10:57 PM
Add chart - what is wrong with the code? tskogstrom Charts and Charting in Excel 3 October 24th 06 05:22 PM
I get wrong dates when i paste from a different sheet into a new s mmollat Excel Discussion (Misc queries) 2 January 6th 05 07:35 PM


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