Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this macro basically done, I am having a problem with settign the source range for the chart though. I think it is simply a syntax error but I am not sure - any advice would be helpful as I am stuck. Here is the part of the code
Dim LastDataRow As Lon LastDataRow = Cells(Rows.Count, "C").End(xlUp).Ro If LastDataRow = 1 Then GoTo MyErrorHandle Els Sheets("InputSheet").Visible = Fals Sheets("Chart1").Visible = Tru Sheets("Chart1").Selec With ActiveChar .SetSourceData Source:=Workbooks("Main.xls").Sheets("DataSheet"). Range("C1", Range("H" & LastDataRow)), PlotBy:=xlColumn .HasTitle = Tru .ChartTitle.Characters.Text = "Chart .Axes(xlValue, xlPrimary).HasTitle = Tru .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Percentage .HasAxis(xlCategory, xlPrimary) = Tru .HasAxis(xlValue, xlPrimary) = Tru .Axes(xlCategory, xlPrimary).CategoryType = xlAutomati .HasLegend = Fals .HasDataTable = Tru .DataTable.ShowLegendKey = Tru End Wit End I Exit Su MyErrorHandler '"Whole bunch of stuff here End Su I am getting the error "Mehtod 'Range' of Object '_Global' Failed" on the .SetSourceData command. And I get some problems with my "if" and "else" statements. What am I doing wrong - looking at it, it should work, I just don't know where I am going wrong Thanks for any advice Jim |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using a named range as a data source for a chart | Charts and Charting in Excel | |||
Problem setting SeriesCollections source range | Charts and Charting in Excel | |||
Setting source data range with Charts | Charts and Charting in Excel | |||
Setting the range in a chart using VB | Excel Programming | |||
change chart source from range to raw data | Excel Programming |