Need urgent help

S

sia.bhavaraju

Hi i have an error at this point in my module saying application
defined or object error defined error.
error 1004

'
If ([Environment].Offset(shopper.Offset(0, 2) + Row, _
shopper.Offset(0, 3) + Column) = _
shopper.Offset(0, 6)) Then

this is the full program
---------------------------------------------------------------------------------------
' This is the nearby area scanning routine.
Sub LookAround(shopper As Range)

' Check the eight neighbouring squares to see if our item is
nearby.
For Row = -1 To 1

' For simplicity we will check our own square too,
' but do not expect to find the item we seek.
For Column = -1 To 1

' Check the next nearby spot for our item.
If ([Environment].Offset(shopper.Offset(0, 2) + Row, _
shopper.Offset(0, 3) + Column) = _
shopper.Offset(0, 6)) Then

' Note that we have found the item of interest.
shopper.Offset(0, 5) = "Found"
Exit For
End If

Next Column

Next Row

End Sub
-------------------------------------------------------
The offset(0,2) is row
offset(0,3) is column
offset(0,5) is status
offset(0,6) is target item in the spread sheet
its urgent please let me know the possible solutions for the error
Regards,
Ram
 
Joined
Aug 30, 2007
Messages
18
Reaction score
0
I would not use column and Row as the variables in the loops.Try using somehting else eg: RW or CL for row and column
 
G

Guest

Maybe use Shopper.offset( ).value

Also, you've not declared all of your variables. I've had problems when I
don't do that, especially with ranges. I'd probably check to see the address
of "shopper" and make sure that you aren't trying to offset to a cell that
doesn't exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top