How to add data Range property at runtime to excel sheet

A

areddy

Hi All,

In excel sheet i have a chart and table for which I am setting dat
range property at design time.based on the data i want to set it at ru
time.

select in chart menu---> Source data --> Data range property we ar
setting at design time. How to set this property at runtime. Pleas
refer the attachment.

could you please help me.

Thanks & Regards in advance,
Aredd

+-------------------------------------------------------------------
|Filename: Excell chart Data range property setting.doc
|Download: http://www.excelforum.com/attachment.php?postid=4323
+-------------------------------------------------------------------
 
L

Leith Ross

Hello Areddy,

_____________________________

Sub ChangeChartDataRange()

Dim Chrt As Chart
Set Chrt = ActiveSheet.ChartObjects("Chart 1").Chart
Chrt.SetSourceData Source:=Worksheets("TestTemplate1").Range(Cells(37
7), Cells(38, 18))

End Sub
_____________________________

Be sure to change "Chart 1" to the system name for your chart. To fin
the system chart name, right click on the chart. Select "Chart Window
from the Popup Menu. The Title will contain the Workbook name an
Worksheet name followed by the chart name. Just use the chart name.

Chart Name Example:
[My Workbook.xls]TestTemplate1 Chart 1

Sincerely,
Leith Ros
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top