Codigo 2
Codigo 2
End Sub
'Grafico
Sub grafico()
Dim n As Integer, p As Single, ChartsTemp As Object, graf As Object
Dim datos As String
n = Cells(9, 1): p = Cells(13, 1)
'Eliminar datos grafico anterior
Set ChartsTemp = ActiveSheet.ChartObjects
If ChartsTemp.Count > 0 Then
ChartsTemp(ChartsTemp.Count).Delete
End If
datos = Range(Cells(3, 2), Cells(p + 3, 3)).Address 'rango a greficar
Set graf = Charts.Add 'grafico y sus caracteristicas
'Caracteristicas
With graf
.Name = "Grafico"
.ChartType = x1XYScatterSmoothNoMarkers
.SetSourceData Source:=Sheets("hoja1").Range(dtos), PlotBy:=x1Columna
.Location Where:=x1LocationAsObject, Name:="Hoja1"
End With
With ActiveChart
.HasTitle = True
.ChartTitle.Charaters.Text = "RESPUESTA AL IMPULSO SISTEMA DE 1er ORDEN"
.Axes(x1Category, x1Primary).HasTitle = True
.Axes(x1Category, x1Primary).AxisTitle.Characters.Text = "tiempo"
.Axes(x1Value, x1Primary).HasTitle = True
.Axes(x1Value, x1Primary).AxisTitle.Characters.Text = "Respuesta Indical"
.Axes(x1Value, x1Primary).HasTitle = True
End With
With ActiveChart.Parent
.Left = 200:
.Top = 20:
End With
'El programa termina en una celda vacia
'Range("A15".select
'ActiveCell.FormulaR1C1=""
'Range("A15").Select
'Selection.Font:Bold=True
'ActiveChart.HasLegend=false
'Activechart.ApplyDataLabels Type:x1dataLabelsShowValue,LegendKey:=False
End Sub