View Full Version : formula error


adaniele
12-15-2005, 02:38 PM
hi all. i 've got an easy problem....
when i run this macro it display the "Run Time Error 451 - Object not a Collection"

k = 2
For i = 2 To 556
For j = 2 To 188
If Worksheets(4).Cells(j, 6) = Worksheets(4).Cells(i, 13) Then
If Worksheets(4).Cells(i, 10) = "P" Then
If Worksheets(4).Cells.Value(k, 18) <> 0 Then
Worksheets(4).Cells(k, 19) = Worksheets(4).Cells.Value(k, 18) / Worksheets(4).Cells.Value(j, 3)
End If
Else
If Worksheets(4).Cells(i, 10) = "J" Then
If Worksheets(4).Cells.Value(k, 18) <> 0 Then
Worksheets(4).Cells(k, 19) = Worksheets(4).Cells.Value(k, 18) / Worksheets(4).Cells.Value(j, 4)
End If
Else
If Worksheets(4).Cells(i, 10) = "Y" Then
If Worksheets(4).Cells.Value(k, 18) <> 0 Then
Worksheets(4).Cells(k, 19) = Worksheets(4).Cells.Value(k, 18) / Worksheets(4).Cells.Value(j, 5)
End If
End If
End If
End If
End If
Next j
k = k + 1
Next i

thx max

shades
12-15-2005, 05:44 PM
Howdy. What line errors out? What happens when you use F8 to step through the code?

Here is one problem:


If Worksheets(4).Cells.Value(k, 18)


Shouldn't this be:


If Worksheets(4).Cells(k, 18).Value