Hola y antes que nada gracias por su ayuda.
Mi pregunta es estoy realizando un programam en vb que te realice calculoas matematicas como permutaciones combinacion probabilidad y cosas por el estilo, pero me gustaria crear graficos en excel.
Mi pregunta es como puedo hacer una grafica en excel ya teniendo los datos en vb.
De ante mano gracias
bueno yo encontre este codigo
Dim apexcel As Variant
Set apexcel = CreateObject("excel.application")
' hace que excel se vea
apexcel.Visible = True
'agrega un nuevo libro
apexcel.workbooks.Add
'poner titulos
apexcel.cells(1, 1).formula = "TITULO DE LA APLICACION"
apexcel.cells(1, 1).Font.Size = 18
apexcel.cells(2, 2).formula = "debe"
apexcel.cells(2, 3).formula = "haber"
apexcel.cells(2, 4).formula = "saldo"
apexcel.cells(3, 2).formula = 200
apexcel.cells(3, 3).formula = 100
' aplica formula<br>
apexcel.cells(3, 4).formula = "=b3-c3"
' hace una seleccion de celdas y pone bordes de color
apexcel.range("b3:d3").borders.Color = RGB(255, 0, 0)
Set apexcel = Nothing
Con este codigo ya puede mandar datos a excel pero como doy la instruccion para generar el grafico.
Espero y me puedan ayudar, GRACIAS
Muchas gracias ya encontre la respuesta lo pongo aqui para quien entre a ver el tema
Private Sub Command1_Click()
Dim oXL As Object ' Excel application
Dim oBook As Object ' Excel workbook
Dim oSheet As Object ' Excel Worksheet
Dim oChart As Object ' Excel Chart
Dim iRow As Integer ' Index variable for the current Row
Dim iCol As Integer ' Index variable for the current Row
Const cNumCols = 10 ' Number of points in each Series
Const cNumRows = 2 ' Number of Series
ReDim aTemp(1 To cNumRows, 1 To cNumCols)
'Start Excel and create a new workbook
Set oXL = CreateObject("Excel.application")
Set oBook = oXL.Workbooks.Add
Set oSheet = oBook.Worksheets.Item(1)
' Insert Random data into Cells for the two Series:
Randomize Now()
For iRow = 1 To cNumRows
For iCol = 1 To cNumCols
aTemp(iRow, iCol) = Int(Rnd * 50) + 1
Next iCol
Next iRow
oSheet.Range("A1").Resize(cNumRows, cNumCols).Value = aTemp
'Add a chart object to the first worksheet
Set oChart = oSheet.ChartObjects.Add(50, 40, 300, 200).Chart
oChart.SetSourceData Source:=oSheet.Range("A1").Resize(cNumRows, cNumCols)
' Make Excel Visible:
oXL.Visible = True
oXL.UserControl = True
End Sub
Aun no le entiendo bien al codigo pero funciona a la perfeccion