formula error (1 Viewer)

adaniele

Registered User.
Local time
Today, 16:14
Joined
Jul 18, 2005
Messages
176
hi all. i 've got an easy problem....
when i run this macro it display the "Run Time Error 451 - Object not a Collection"

Code:
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

Registered User.
Local time
Today, 00:14
Joined
Mar 25, 2002
Messages
516
Howdy. What line errors out? What happens when you use F8 to step through the code?

Here is one problem:

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

Shouldn't this be:

Code:
If Worksheets(4).Cells(k, 18).Value
________
FORD EXPEDITION HISTORY
 
Last edited:

Users who are viewing this thread

Top Bottom