|
Q+ Marionet,
Prueba con esto:
- Agrega a tu formulario un Control SpreadSheet 9.0 y un control ChartSpace 9.0
- Luego utiliza este código para el formulario:
Option Explicit
Private Sub UserForm_Initialize()
With ChartSpace1
' Add a chart.
.Charts.Add
' Set the data source of the chart to the Spreadsheet control.
.DataSource = Spreadsheet1
With .Charts(0)
' Create a bar chart.
.Type = chChartTypeBarClustered
' Add two data series to the chart.
.SeriesCollection.Add
.SeriesCollection.Add
' Set the properties of the first data series.
With .SeriesCollection(0)
.SetData chDimSeriesNames, 0, "B1"
.SetData chDimCategories, 0, "A2:A5"
.SetData chDimValues, 0, "B2:B5"
End With
' Set the properties of the second data series.
With .SeriesCollection(1)
.SetData chDimSeriesNames, 0, "C1"
.SetData chDimValues, 0, "C2:C5"
End With
' Display the legend.
.HasLegend = True
End With
End With
End Sub
Saludos,
RCh.
|