VBA Run-time Error '6': Overflow

bluegold

Active Member
Joined
Jun 21, 2009
Messages
277
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
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,492
Office Version
  1. 365
Platform
  1. Windows
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?
 
Solution

bluegold

Active Member
Joined
Jun 21, 2009
Messages
277
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 :)
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,492
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,009
Messages
5,622,143
Members
415,880
Latest member
Bruce0203

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
Top