Thread
:
Chart location and source...
View Single Post
#
3
Posted to microsoft.public.excel.programming
Tushar Mehta
external usenet poster
Posts: 1,071
Chart location and source...
In article ,
says...
I think I have problems with SetSourceData...
All this is contained in a loop, which provides the j value. I'm not sure
what to put in Cells() - but it should be the entire worksheet. There is no
data in the worksheet that is not part of the chart.
You really should check out the macro recorder. Of course, it will
only give you the final result for the chart. You may find you have to
adapt the code to use .Cells(1,3).CurrentRegion -- which will work as
long as your data are in a single contiguous area.
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
Are you having problems? Or is this an academic question?
Yes, I am definitely having problems. In my haste to post I did not state
the problem - sorry.
If the former, switch the sequence of the .ChartType and the
.SetSourceData statements.
So the way to go is:
Add
Location
Source
Type
Other stuff
?
Here's the latest:
xlapp.Workbooks(strXlsFile).Charts.Add.Name = strSheetName & " Chart"
xlapp.Workbooks(strXlsFile).ActiveChart.SetSourceD ata Source:= _
xlapp.Workbooks(strXlsFile).Worksheets(j + 1).Cells(1, 3),
PlotBy:=xlColumns
xlapp.Workbooks(strXlsFile).ActiveChart.ChartType = xlLineMarkers
xlapp.Workbooks(strXlsFile).ActiveChart.HasLegend = False
xlapp.Workbooks(strXlsFile).ActiveChart.ApplyDataL abels
Type:=xlDataLabelsShowValue
I think I have problems with SetSourceData...
All this is contained in a loop, which provides the j value. I'm not sure
what to put in Cells() - but it should be the entire worksheet. There is no
data in the worksheet that is not part of the chart.
As for Location, this code creates a separate sheet for the chart. How
would I specify a worksheet (the active worksheet) as a location?
Thanks in advance.
Reply With Quote
Tushar Mehta
View Public Profile
Find all posts by Tushar Mehta