Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default xlLocationAsObject

Hi, I have a question regarding adding a new chart. I'm
running a macro on one workbook that will create graphs in
another workbook. I'm trying to create a graph that will
display as part of the newest worksheet of the new
workbook. This macro will run every so often, inserting
new pages into the new workbook, which then would show
charts on that page.

My problem is with the "ActiveChart.Location
Whe=xlLocationAsObject, Name:=Worksheets(1)" line. Is
it only possible to use xlLocationAsObject with a sheet
name? I would much rather be able to use the index value
of the worksheets since, the names of the sheets will keep
incrementing as new pages are added.

I'll post the code below. Thanks in advance.




With Workbooks(Workbooks.Count).Worksheets(1)
Charts.Add
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = Worksheets
(1).Range("B2:B57")
ActiveChart.SeriesCollection(1).Values = Worksheets
(1).Range("A2:A57")
ActiveChart.Location Whe=xlLocationAsObject,
Name:=Worksheets(1)
ActiveChart.HasLegend = False
End With
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



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