I searched this forum and found this code to run 60 simple regressions for a range of data in column 3 against the range data in column 65, then 4 against 66, then 5 against 67, and so on. What I would like is however to modify the code for a range of data that contains non numeric data (i.e. blank but not empty cells like ""). Unfortunately, I can't seem to correctly modify the code in order to make that happen. Can anyone help me please? Thanking you in anticipation.
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