Hi,
I have some code which loops through a range called rngAnalysisList and assigns value to variables. The range is a table list analyses. The code then copies a template results page ready to fill out. The results page has 3 graphs and a table on it.
I am getting the following error
The specified Dimension is not valid for the current chart type
When it gets to copying the template for the second time.
Here is my code
Private Sub test()
Dim i As Integer, j As Integer
Dim myRange As Range
Dim ImportTypeVal As String, EDMVal As String, AccVal As String, IDVal As String
Application.ScreenUpdating = False
Set myRange = wksModeller.Range("rngAnalysisList")
For i = 1 To myRange.Rows.Count
For j = 1 To myRange.Columns.Count
If j = 1 Then
IDVal = myRange.Cells(i, j).Value
ElseIf j = 5 Then
ImportTypeVal = myRange.Cells(i, j).Value
ElseIf j = 6 Then
EDMVal = myRange.Cells(i, j).Value
ElseIf j = 7 Then
AccVal = myRange.Cells(i, j).Value
Else
End If
Next j
Sheets("Template").Copy After:=Sheets("Modeller")
ThisWorkbook.VBProject.VBComponents("wksTemplate1").Name = "wksAnalysis" & IDVal
Sheets("Template (2)").Name = "Analysis" & IDVal
Next i
Application.ScreenUpdating = True
End Sub
Why would this be causing this error?
Thanks