Consulting

Results 1 to 3 of 3

Thread: Solved: Using a range in a chart with VBA

  1. #1
    VBAX Regular
    Joined
    May 2006
    Posts
    33
    Location

    Solved: Using a range in a chart with VBA

    Hi !

    I am trying to create a chart that grows as the range that it's based on grows.
    I have a set of data that starts at F2 and grows (f3, f4..). Now, what i want to do is to make the chart grow with the range.
    I got the graph working fine, buti can only set it to a fixed range.
    The graph is redrawn everytime a new value is added.

    [VBA]
    Charts.Add
    ActiveChart.ChartType = xlLineMarkers
    ActiveChart.SetSourceData Source:=Sheets("Sheet2").Range("F2:F25"), PlotBy _
    :=xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
    With ActiveChart
    .HasTitle = True
    .ChartTitle.Characters.Text = "Flextid"
    .Axes(xlCategory, xlPrimary).HasTitle = False
    .Axes(xlValue, xlPrimary).HasTitle = False
    End With
    ActiveChart.HasLegend = False
    With Selection.Border
    .ColorIndex = 2
    .Weight = 2
    .LineStyle = 1
    End With
    With Selection.Interior
    .ColorIndex = 2
    .PatternColorIndex = 56
    .Pattern = 1
    End With
    Range("A9").Select
    [/VBA]

    Is it possible to make a dynamic graph like that ? How do i do it ?
    Thanks!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location

  3. #3
    VBAX Regular
    Joined
    May 2006
    Posts
    33
    Location

    Thumbs up Thanks!

    Thanks a lot!

Posting Permissions

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