I have some VB coding that hides rows above and below the required cell values that will be used as the source data for a simple line chart.
How can I select the remaining (unhidden) cell range as my SetSourceData range ?
I can select the range with the following ...
Range("D6").Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
... the range always begins in the cell beneath cell C6.
When I try to use this as my SetSourceData range ...
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("D6").Offset(1, 0).Select.Range(Selection, Selection.End(xlDown)).Select
ActiveChart.ChartType = xlLine
... I get the following error:
Run-time error '438': Object doesn't support this property method
Any ideas ?
Thanks
Actually, the following code selects the data I need a little better...
Range("D7", Cells(Rows.count, "D").End(xlUp)).SpecialCells(xlCellTypeVisible).Select
... but, how do I use this as a data source for my chart ?