creates the chart with absolute reference and format it : Chart Format « Excel « VBA / Excel / Access / Word






creates the chart with absolute reference and format it

 
Sub CreateOHCLChart()
    Dim myChart As Chart
    Dim Ser As Series

    ActiveSheet.Shapes.AddChart(xlLineMarkers).Select
    Set myChart = ActiveChart
    myChart.SetSourceData Source:=range("Sheet1!$A$1:$E$33")

    With myChart.SeriesCollection(1)
        .MarkerStyle = xlMarkerStylePicture
        .Fill.UserPicture ("C:\dash.gif")
        .Border.LineStyle = xlNone
        .MarkerForegroundColorIndex = xlColorIndexNone
    End With

    With myChart.SeriesCollection(2)
        .MarkerStyle = xlMarkerStyleNone
        .Border.LineStyle = xlNone
    End With
    With myChart.SeriesCollection(3)
        .MarkerStyle = xlMarkerStyleNone
        .Border.LineStyle = xlNone
    End With
    ' Format the Close series
    Set Ser = myChart.SeriesCollection(4)
    With Ser
        .MarkerBackgroundColorIndex = 1
        .MarkerForegroundColorIndex = 1
        .MarkerStyle = xlDot
        .MarkerSize = 9
        .Border.LineStyle = xlNone
    End With
    ' Add High-Low Lines
    myChart.SetElement (msoElementLineHiLoLine)
    myChart.SetElement (msoElementLegendNone)

End Sub

 








Related examples in the same category

1.Manipulating Charts
2.Adds major gridlines, title, and x-axis labels to an embedded chart
3.Loop through each series in chart and alter marker colors
4.Add Chart Sheet
5.Background and Foreground color
6.Working with a Chart Axis
7.Formatting a Basic Chart
8.Format Axis, Title font size and color
9.Set Axes gridline and its border color
10.Set PlotArea LineStyle, border color, width and height
11.Looping through the ChartObjects collection: changes the chart type of every embedded chart on the active sheet.
12.works on all the chart sheets in the active workbook
13.Modifying chart properties: changes the Legend font for all charts on the active sheet.
14.Applying chart formatting
15.Changing a Chart Title Using VBA
16.To fill the bars of a data series with a picture
17.sets up a two-color gradient using two theme colors:
18.formats the trendline for the first series in a chart:
19.formatting a border
20.adds a line around the title and adds a glow around that line:
21.adds a light blue shadow to the box surrounding a legend:
22.proper syntax for SoftEdge:
23.Format Soft Edges With Loop
24.To apply one of the 3-D rotation presets to a chart element: use the SetPresetCamera method
25.Changing the Bevel and 3-D Format
26.defines a Chart object variable and a ChartGroup object variable and then stops: