Consulting

Results 1 to 3 of 3

Thread: chart properties in recording macro

  1. #1
    VBAX Newbie
    Joined
    May 2011
    Posts
    5
    Location

    chart properties in recording macro

    Hi, im new using vba excel and im using excel 2007.
    im create chart using recording macro and here my code:
    [vba]
    Private Sub CommandButton1_Click()

    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.SetSourceData Source:=Range( _
    "'siklus'!$B$2:$B$2709,'siklus'!$C$2:$C$2709,'siklus'!$U$2:$U$2709")
    ActiveChart.ChartType = xlLine

    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.SetSourceData Source:=Range( _
    "'siklus'!$B$2:$B$2709,'siklus'!$D$2:$D$2709,'siklus'!$U$2:$U$2709")
    ActiveChart.ChartType = xlLine
    .
    .
    .
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.SetSourceData Source:=Range( _
    "'siklus'!$B$2:$B$2709,'siklus'!$T$2:$T$2709,'siklus'!$U$2:$U$2709")
    ActiveChart.ChartType = xlLine

    End Sub

    [/vba]
    my question is how to coloring data series,change legend position to bottom.

    thx

    *Sorry for my bad english...

  2. #2
    VBAX Mentor
    Joined
    Aug 2008
    Posts
    323
    Location
    Changing color of the Series line
    [VBA]ActiveChart.SeriesCollection(2).Select
    With Selection.Format.Line
    .Visible = msoTrue
    .ForeColor.ObjectThemeColor = msoThemeColorAccent1
    .ForeColor.TintAndShade = 0
    .ForeColor.Brightness = 0
    End With[/VBA]
    For moving the legend:
    [VBA]ActiveChart.Legend.Select
    Selection.Left = 320
    Selection.Top = 235[/VBA]
    I am a Newbie, soon to be a Guru

  3. #3
    VBAX Newbie
    Joined
    May 2011
    Posts
    5
    Location
    hi nepotist thx for reply

    for changing color of the series line i have error message "Object doesn't support this property or method"
    and for moving legend no error but i want show the legend in the middle bottom and without overlapping the chart

    thx again

Posting Permissions

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