Hi,
I am getting the below error in the macro , can someone look and help me out in rectifying. Error coming on line ActiveSheet.ChartObjects("Chart 1").Activate with description as "The item with specified name not found"
I am getting the below error in the macro , can someone look and help me out in rectifying. Error coming on line ActiveSheet.ChartObjects("Chart 1").Activate with description as "The item with specified name not found"
Code:
Sub Chrt()
'
' Chrt Macro
'
'
Dim strRng As Long
Dim sub1 As Integer
sub1 = 1
strRng = Range("A" & Rows.Count).End(xlUp).Row
strRng = strRng - sub1
Range("Q2").FormulaR1C1 = "=MIN(R[2]C[-1]:R[" & strRng & "]C[-1])"
strRng = Range("A" & Rows.Count).End(xlUp).Row
Range("A1:P" & strRng).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("'Sheet2'!$A$1:$P$" & strRng)
ActiveChart.ChartType = xlLine
ActiveChart.Axes(xlValue).Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).MinimumScale = 0
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).MinimumScale = Sheets("sheet2").Range("Q2")
End Sub
[/chart]