+ Reply to Thread
Results 1 to 2 of 2

How to add data Range property at runtime to excel sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    10-19-2005
    Posts
    38

    Question How to add data Range property at runtime to excel sheet

    Hi All,

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

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

    could you please help me.

    Thanks & Regards in advance,
    Areddy
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    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 find the system chart name, right click on the chart. Select "Chart Window" from the Popup Menu. The Title will contain the Workbook name and Worksheet name followed by the chart name. Just use the chart name.

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

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1