Autofilter Rows short of Requested Range

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
The below is extracted code (from a standard module)

Code:
....
Dim flr as Long
....
Application.ScreenUpdating = False
Application.Calculation = xlManual
......

Range("G2").Select
  
  flr = Range("D" & Rows.Count).End(xlUp).Row  
    Range("G2:G" & flr).Formula = "=ISNUMBER(A2)"
    Range("A1:G" & flr).AutoFilter Field:=7, Criteria1:="FALSE"
    Range("A1").Select
    ActiveCell.Offset(1, 0).Rows("2:" & flr).EntireRow.Delete
    ActiveSheet.ShowAllData
.....
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

My flr variable is assigned 6338, yet the actual Filtered-rows - going by the "blue" row-headers is stopping at 4184. My Col G (Field:=7) rows 2-4184 are 100% False, but between rows 4185 and 6338 (not being picked up in A/F) are showing multiple FALSE and TRUE Values. Which means the TRUE values in rows 4185-6338 are getting deleted, and should NOT!! Does anyone see something that can be done to fix this? TIA, Jim:(
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Adding this one line (in red) seems to correct things... Tks..

Rich (BB code):
flr = Range("D" & Rows.Count).End(xlUp).Row
    Range("G2:G" & flr).Formula = "=ISNUMBER(A2)"
    ActiveSheet.AutoFilterMode = False  'add to re-set A/F in next line
    Range("A1:G" & flr).AutoFilter Field:=7, Criteria1:=False
    Range("A1").Select
:)
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

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