Overflow error

B

Barb Reinhardt

I'm frequently getting an overflow error on this line of code

Set FindCell = .Cells.Find(What:=myPattern, _
After:=.Cells(.Cells.Count), _
lookat:=xlWhole, _
searchorder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


can someone help me figure out why. I've recently moved to Office 2007 and
am seeing it there when I didn't see it in Office 2003.

Thanks,
Barb Reinhardt
 
B

Bob Umlas

depending on what the With statement has, the reference to .cells.count in
xl2007 could be referring to 1048576 * 16384 cells!!
That could account for the overflow. What's the With-statement?
 
J

JLGWhiz

After:=.Cells(.Cells.Count)

Ambiguous reference. It would be better to use a Range reference here, like
Range("A" & lastRow), assuming you have defined a last row. XL2007 has a
lot of rows.
 
D

Dave Peterson

That big worksheet made .cells.count way too big.

I think you'll want to use this in xl2007:
.cells(.cells.countlarge)
 

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

Similar Threads

Upper Case and Lower Case 5
Copying a Cell 4
Macro getting stuck 4
move cell 5
Test if Cell is Empty or Doesn't Exist 2
Method 'Range" of object'_Global' failed 2
Loop 4
variable = current cell in VB 5

Top