How to I increment the x and y data sets by one?
-------------------
Sub main_ols()
Dim x, y, z,
Dim strMsg As String
For x = 2 To 500
x = RangeToArray(Sheet4.Range("B2:B51"))
y = RangeToArray(Sheet4.Range("C2:C51"))
z = regress_orthols(x, y)
strMsg = "1.slope" & vbTab & z(1) & vbNewLine
strMsg = strMsg & "2.intercept" & vbTab & z(2) & vbNewLine
strMsg = strMsg & "3.sigma_slope" & vbTab & z(3) & vbNewLine
strMsg = strMsg & "4.sigma_intercept" & vbTab & z(4) & vbNewLine
MsgBox strMsg, vbInformation, "Least-squares Orthogonal Regression Result"
Sheet4.Range("slope") = z(1)
Sheet4.Range("intercept") = z(2)
z = regress_ls(x, y)
strMsg = "1.slope" & vbTab & z(1) & vbNewLine
strMsg = strMsg & "2.intercept" & vbTab & z(2) & vbNewLine
strMsg = strMsg & "3.sigma_slope" & vbTab & z(3) & vbNewLine
strMsg = strMsg & "4.sigma_intercept" & vbTab & z(4) & vbNewLine
MsgBox strMsg, vbInformation, "Least-squares Regression Result"
Next
Set x = RangeToArray("B2:B51").Offset([1], [0]).Select
Set y = Range("y").Offset(1, 0).Select
z = regress_orthols(x, y)
Set z(1) = Sheet4.Range("slope").Offset(1, 0).Select
Set z(2) = Sheet4.Range("intercept").Offset(1, 0).Select
Sheet4.Range("slope") = z(1)
Sheet4.Range("intercept") = z(2)
-------------------
Sub main_ols()
Dim x, y, z,
Dim strMsg As String
For x = 2 To 500
x = RangeToArray(Sheet4.Range("B2:B51"))
y = RangeToArray(Sheet4.Range("C2:C51"))
z = regress_orthols(x, y)
strMsg = "1.slope" & vbTab & z(1) & vbNewLine
strMsg = strMsg & "2.intercept" & vbTab & z(2) & vbNewLine
strMsg = strMsg & "3.sigma_slope" & vbTab & z(3) & vbNewLine
strMsg = strMsg & "4.sigma_intercept" & vbTab & z(4) & vbNewLine
MsgBox strMsg, vbInformation, "Least-squares Orthogonal Regression Result"
Sheet4.Range("slope") = z(1)
Sheet4.Range("intercept") = z(2)
z = regress_ls(x, y)
strMsg = "1.slope" & vbTab & z(1) & vbNewLine
strMsg = strMsg & "2.intercept" & vbTab & z(2) & vbNewLine
strMsg = strMsg & "3.sigma_slope" & vbTab & z(3) & vbNewLine
strMsg = strMsg & "4.sigma_intercept" & vbTab & z(4) & vbNewLine
MsgBox strMsg, vbInformation, "Least-squares Regression Result"
Next
Set x = RangeToArray("B2:B51").Offset([1], [0]).Select
Set y = Range("y").Offset(1, 0).Select
z = regress_orthols(x, y)
Set z(1) = Sheet4.Range("slope").Offset(1, 0).Select
Set z(2) = Sheet4.Range("intercept").Offset(1, 0).Select
Sheet4.Range("slope") = z(1)
Sheet4.Range("intercept") = z(2)