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: 17
Default Another VBA Chart problem Excel 97

Hi I have used macro recorder to create a chart on a sheet which is run
under sheet activate. The problem is the code referances 'Chart 1.... etc'
obviously each chart created on one of 37 sheets a new Chart number is
created so the code wont run.

Prob 1: Can "Chart 17" in the code be replaced with say activechart?
Prob 2: I need the graph to be placed in cells C2:AF10 is there a way I can
specify the exact size and position of the chart within the code?

Code Below

Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Mon 2nd-w1").Range("A1")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "='Mon 2nd-w1'!R43C3:R43C32"
ActiveChart.SeriesCollection(1).Values = "='Mon 2nd-w1'!R44C3:R44C32"
ActiveChart.SeriesCollection(2).Values = "='Mon 2nd-w1'!R16C3:R16C32"
ActiveChart.SeriesCollection(3).Values = "='Mon 2nd-w1'!R51C3:R51C32"
ActiveChart.Location Whe=xlLocationAsObject, Name:="Mon 2nd-w1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveSheet.Shapes("Chart 17").IncrementLeft -741#
ActiveSheet.Shapes("Chart 17").IncrementTop -546#
ActiveWindow.Visible = False
ActiveSheet.ChartObjects("Chart 17").Activate
ActiveChart.Axes(xlCategory).Select
ActiveWindow.Visible = False
Windows("Monthly Wage Tool - Blank 2006 v1_1.xls").Activate
Range("C1").Select
ActiveSheet.ChartObjects("Chart 17").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 17").ScaleHeight 0.7, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 17").ScaleHeight 0.91, msoFalse,
msoScaleFromBottomRight


Many Thanks as always for your replies and most of all to Tom who has saved
me so much time Cheers :-)



 
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 Chart Problem!!! (Bug I think) Jose Cadeado Charts and Charting in Excel 2 November 5th 08 11:26 AM
Problem with Name of Excel Chart [email protected] Excel Programming 0 September 22nd 05 05:21 PM
Excel chart problem Mike1 Excel Worksheet Functions 0 September 13th 05 10:48 PM
Excel chart problem B. R.Ramachandran Excel Worksheet Functions 0 September 13th 05 10:32 PM
Excel VBA - Chart title problem OO7_neverdie Excel Programming 2 January 6th 04 11:18 PM


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