VBA Run-time Error '6': Overflow

bluegold

Active Member
Joined
Jun 21, 2009
Messages
279
Hi guys,

This one has me stumped as I have run this macro for years and only now it starts coming up the error Run-time Error '6': Overflow

Here is my piece of code and where the error occurs - See bold yellow.

Sheets("f.Win").Range("A2:AS" & Sheets("f.Win").Range("A" & Rows.Count).End(xlUp).Row).Delete
Lastrowa = Sheets("f.Win").Cells(Rows.Count, "A").End(xlUp).Row + 1
With Sheets("Football")
Lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For I = 2 To Lastrow
If .Cells(I, 46).Value = "True" Then
.Cells(I, 1).Resize(, 45).Copy Destination:=Sheets("f.Win").Rows(Lastrowa)
Lastrowa = Lastrowa + 1
End If
Next
End With
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Have you declared the "Lastrow" variable?
If so, which type did you choose? If you chose something like "Integer", and your last row is over row 32767, that would cause an error, and you need to use something like "Long" instead.

Also, are you sure that you have a sheet named "Football", and it is not hidden?
 
Upvote 0
Solution
yep that did it, just read integer only supports 32758 rows or something and I just happened to pass that the other day lol
Thanks for your help :)
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top