AutoFilter isn't working it goes to another row

Sonyafm

New Member
Joined
Mar 3, 2015
Messages
18
Thank you in advance!

I have two issues with Autofilter
1. Autofilter is going to the first row instead of row 8
2. Is not filtering out blanks and/ or cells with formula that results in a "-" o dash
Code:

Sub hideemptyrows2()

Worksheets("Indirect Cost Forecast").Activate


Sheets("Indirect Cost Forecast").Activate
Rows("8:8").Select
Selection.AutoFilter Field:=5, Criteria1:="<>"

End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Do you have headers on row 8?
If the answer is yes what happens with the code below?
Code:
Sub hideemptyrows2x()
    With Sheets("Indirect Cost Forecast")
        .Range("A8:E" & .Range("E" & Rows.Count).End(xlUp).Row).AutoFilter Field:=5, _
                                    Criteria1:="<>", Operator:=xlAnd, Criteria2:="<>-"
    End With
End Sub
 
Last edited:
Upvote 0
Do you have headers on row 8?
If the answer is yes what happens with the code below?
Code:
Sub hideemptyrows2x()
    With Sheets("Indirect Cost Forecast")
        .Range("A8:E" & .Range("E" & Rows.Count).End(xlUp).Row).AutoFilter Field:=5, _
                                    Criteria1:="<>", Operator:=xlAnd, Criteria2:="<>-"
    End With
End Sub

Yes, rows below have numbers and I want to show only the numbers no blanks.
 
Upvote 0
Thanks for your reply,
I tried the new code and the filter goes to the first row.
The sheet has titles on row 8. on Row 1 I have other titles too.
 
Upvote 0
The filter continues to go to the incorrect row 1 instead of row 8. This is so bizzare
 
Last edited:
Upvote 0
Post a sample of your data (sanitize any sensitive data). See my signature block below for links to addins to do this or upload a copy of your workbook to a free file hosting site like www.box.com or www.dropbox.com, mark it for sharing and post the link it provides in the thread.

Please do not try and post an unusable image like a Png, Jpeg etc.
 
Upvote 0
Sorry but when I run the code I posted on your file from a regular macro it is putting the filter on row 8.
@Fluff, any chance you can test at your end?
 
Upvote 0

Forum statistics

Threads
1,214,917
Messages
6,122,233
Members
449,075
Latest member
staticfluids

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