Run Time Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am getting a Run time Error 1004 Method 'Range' of
object'_Global' failed.

Here is my code and I will show the line that the
debugger shows. Any help would be great. Thanks

x = i
y = i - 2
Do Until i = FinalRow

***(This Row) If Not ((Range("E" & y).Value) = (Range("D"
& x).Value)) And Not (x = FinalRow) Then
x = x + 1
End If

If (Range("E" & y).Value) = (Range("D" & x).Value) Then
Call OtherSections(i, x)
Do Until (Range("F" & (i - 1)).Value) = ""
ChildRow = Columns(1).Find(What:=(Range("F" & (i -
1)).Value), LookIn:=xlFormulas).Row
Call OtherSections(i, ChildRow)
Loop
y = i - 2
Else
y = y - 1
End If

Loop


i is the next row that is going to have something pasted
to it.

x is the number of the row as it checks to see if the
value in D equals the value in E

y is another counter in case D never equals E, y moves
the row that E is in up one.

At the end of the called funtion i gets increased by 1.

Thank you very much
 
what does the counter i start at?

Since y = i - 2, if i starts anywhere below 3, trying to
access range("E" & y) would cause it to access cell E0, or
E-1, etc... which don't exist.

That would give you the error you mentioned.
 
i starts at 3


-----Original Message-----
what does the counter i start at?

Since y = i - 2, if i starts anywhere below 3, trying to
access range("E" & y) would cause it to access cell E0, or
E-1, etc... which don't exist.

That would give you the error you mentioned.



.
 
i starts at 3


well good, then.

I just put the code into a sheet here, and it works.

When it buggs, can you press 'Debug' and then position the
cursor over your variables to see what they are at the
time of the failure?

Or put in some Watches for them and step through?
 

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

Back
Top