Filtered Range Overflow Error (Excel 2007)

novel

New Member
Joined
Jan 16, 2012
Messages
39
The code that is causing the issue is this

Code:
visibleEnd = rngFiltered.Range("A1").End(xlDown).Row

visibleEnd is the last row of a filtered range. rngFiltered is the filtered range. it is defined as follows

Code:
Set rngFiltered = Sheets(sname).AutoFilter.Range.Offset(1,0).SpecialCells(xlCellTypeVisible)

sname is a variable to hold the sheet name

In the debugger, the xlDown = -4121 and the entire statement is 1048576, the variable itself is 0 since the error 6 Overflow is occurring.

I'm filtering for blanks and replacing them with a value. The number of rows in my worksheets vary from 200 to 90k+. In this particular instance the number of rows is 7043. There is only blank and it is on this last row in a particular column.

This error only occurs when there is only one row that is returned when the filter executes.
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Watch MrExcel Video

Forum statistics

Threads
1,123,320
Messages
5,600,940
Members
414,417
Latest member
Nobu

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