try with the indicated changes, primarily omit the j loop but put j always=i+62
Sub aaa()
Dim DataSH As Worksheet, OutSH As Worksheet
Dim rngY As Range, rngX As Range, rngOut As Range
Dim i As Long, j As Long
Set DataSH = Sheets("Data 2")
Set OutSH = Sheets("Sheet2")
OutSH.Cells.ClearContents
OutSH.Activate
For i = 3 To 63
'For j = 65 To 125
j = i + 62
Application.StatusBar = i & ":" & j
With DataSH
Set rngY = .Range(.Cells(5, i), .Cells(5, i).End(xlDown))
Set rngX = .Range(.Cells(5, j), .Cells(5, j).End(xlDown))
End With
Cells(Rows.Count, "A").End(xlUp).Offset(2, 0).Value = DataSH.Cells(5, i) & " : " & DataSH.Cells(5, j)
Set rngOut = Cells(Rows.Count, "A").End(xlUp).Offset(2, 0)
Application.Run "ATPVBAEN.XLAM!Regress", rngY, rngX, False, True, , rngOut, False _
, False, False, False, , False
'Next j
Next i
Application.StatusBar = False
End Sub
Bookmarks