+ Reply to Thread
Results 1 to 2 of 2

Creating chart by passing sourcedata as variable range

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    delhi, india
    MS-Off Ver
    Excel 2007
    Posts
    35

    Creating chart by passing sourcedata as variable range

    Hi All,

    I am trying but not getting the exat result, I want to create a dynamic column chart by passing the ranges as source data which should varry accroding to condition.

    for e.g


    below given code will create a chart from data A1:E10


    With Sheet1.ChartObjects.Add(Left:=10, Width:=500, Top:=70, Height:=275)

    .Chart.ChartType = xlColumnClustered
    .Chart.SetSourceData Source:=Sheets("Sheet1").Range("'Sheet1'!$Al$1:$E$10")
    .Chart.Legend.Select
    .Chart.SetElement (msoElementLegendBottom)

    End With

    I need a Code if range F1 value if 5,

    sourcedata shoul be A1:E10

    if F1 value change to 4, Source data of chart change to A1:F10

    Means F1 Defines the number of columns for chart and source data.

    Please help, If it is Possible realy great.


    Lots of thanks in advance


    Regards,
    lavi

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Creating chart by passing sourcedata as variable range

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Remember what the dormouse said
    Feed your head

+ 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