+ Reply to Thread
Results 1 to 2 of 2

Union not creating a continuous line graph

  1. #1
    Registered User
    Join Date
    08-11-2010
    Location
    Oakland, California
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Union not creating a continuous line graph

    Hi,

    I have seen similar posts to the question I have, but I have come across a stumbling block. Your help is appreciated.

    I am trying to combine three separate ranges that are not continuous. I would like those range values to be displayed as one continuous line. Currently the ranges are being displayed as three separate lines on one line graph.

    Below is a snapshot of code that is giving me the issue.

    Thank you!




    Loop based on modular product counter
    For i = 1 To mProductCounter

    With ActiveSheet.ChartObjects.Add _
    (Left:=10, Width:=375, Top:=((mOffsetFactor) * (i) * 15), Height:=225)

    'Set range objects
    Set ObjRangeA = Worksheets(Replace(txtDate.Text, "/", "-") & " " & SHEET_REF).Range("$B$10:$P$10").Offset(OFF_SET_FACTOR * (i - 1), 0)
    Set ObjRangeB = Worksheets(Replace(txtDate.Text, "/", "-") & " " & SHEET_REF).Range("$B$13:$P$13").Offset(OFF_SET_FACTOR * (i - 1), 0)
    Set ObjRangeC = Worksheets(Replace(txtDate.Text, "/", "-") & " " & SHEET_REF).Range("$B$16:$P$16").Offset(OFF_SET_FACTOR * (i - 1), 0)

    'Combine objects into one range for a continuous line
    Set myRange = Application.Union(ObjRangeA, ObjRangeB, ObjRangeC)

    myRange.Select
    .Chart.ChartType = xlLine
    .Chart.HasLegend = False


    End With

    With Worksheets(Replace(txtDate.Text, "/", "-") & " " & SHEET_REF).ChartObjects(i).Chart
    .HasTitle = True
    .ChartTitle.Text = cboProduct.Text & " " & "Line" & " " & cboLine.Text
    .SetSourceData Source:=myRange
    End With

    Next i
    Last edited by DandT; 08-11-2010 at 02:29 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Union not creating a continuous line graph

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.

    EDIT: Not QUOTE tags, CODE tags, please.
    Last edited by shg; 08-11-2010 at 06:22 PM.
    Entia non sunt multiplicanda sine necessitate

+ 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