So I'm getting another object-defined error. What am I doing wrong?
The hilighted parts are the four statements: 'if i=....and j=...'
for w=1 to 134
For I = 1 To 8
For j = I + 1 To 9
If I = 2 Then c = 28
If I = 3 Then c = 16
If I = 4 Then c = 17
If I = 5 Then c = 19
If I = 6 Then c = 20
If I = 7 Then c = 21
If I = 8 Then c = 23
If j = 2 Then d = 28
If j = 3 Then d = 16
If j = 4 Then d = 17
If j = 5 Then d = 19
If j = 6 Then d = 20
If j = 7 Then d = 21
If j = 8 Then d = 23
If j = 9 Then d = 25
If I = 1 And j = 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * (1 / Worksheets("Coefficients").Cells(23, 8)) + Worksheets("Normalized Expanded").Cells(w, 25)
If I > 1 And j = 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * Log(Worksheets("NOrmalized Expanded").Cells(w, c)) * Worksheets("Normalized Expanded").Cells(w, 25)
If I > 1 And j < 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * Log(Worksheets("Normalized Expanded").Cells(w, c)) * Log(Worksheets("Normalized Expanded").Cells(w, d))
If I = 1 And j < 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * (1 / Worksheets("Coefficients").Cells(23, 8)) * Log(Worksheets("Normalized Expanded").Cells(w, d))
Next j
Next I
The hilighted parts are the four statements: 'if i=....and j=...'
for w=1 to 134
For I = 1 To 8
For j = I + 1 To 9
If I = 2 Then c = 28
If I = 3 Then c = 16
If I = 4 Then c = 17
If I = 5 Then c = 19
If I = 6 Then c = 20
If I = 7 Then c = 21
If I = 8 Then c = 23
If j = 2 Then d = 28
If j = 3 Then d = 16
If j = 4 Then d = 17
If j = 5 Then d = 19
If j = 6 Then d = 20
If j = 7 Then d = 21
If j = 8 Then d = 23
If j = 9 Then d = 25
If I = 1 And j = 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * (1 / Worksheets("Coefficients").Cells(23, 8)) + Worksheets("Normalized Expanded").Cells(w, 25)
If I > 1 And j = 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * Log(Worksheets("NOrmalized Expanded").Cells(w, c)) * Worksheets("Normalized Expanded").Cells(w, 25)
If I > 1 And j < 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * Log(Worksheets("Normalized Expanded").Cells(w, c)) * Log(Worksheets("Normalized Expanded").Cells(w, d))
If I = 1 And j < 9 Then Z = Z + Worksheets("Cor.Cov. Tables").Cells(I + 13, j + 12) * (1 / Worksheets("Coefficients").Cells(23, 8)) * Log(Worksheets("Normalized Expanded").Cells(w, d))
Next j
Next I