Solved

Excel 2016 - AutoFilter on selected columns issue

Posted on 2016-10-19
5
47 Views
Last Modified: 2016-10-19
When I do this I should get AutoFilters on columns 1 and 3. But I get 2 and 4 (see image).
Tried to fudge it with Field:=0 I get an error.

The odd behaviour that I get
According to here it should work.

Sub AutoFilterDropdownsON()

    With Range("E6:I6")
        .AutoFilter Field:=1, visibledropdown:=True
        .AutoFilter Field:=2, visibledropdown:=False
        .AutoFilter Field:=3, visibledropdown:=True
        .AutoFilter Field:=4, visibledropdown:=False
    End With

End Sub

Open in new window


Thanks for any ideas on this.
0
Comment
Question by:hindersaliva
  • 3
  • 2
5 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 41849880
Hi,

Could you send a dummy?
Cannot reproduce error

Regards
0
 

Author Comment

by:hindersaliva
ID: 41849900
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 41849918
Hi,

pls try
Sub AutoFilterDropdownsON()

    With Range("E5:I5")
        .AutoFilter
        .AutoFilter Field:=1, visibledropdown:=True
        .AutoFilter Field:=2, visibledropdown:=False
        .AutoFilter Field:=3, visibledropdown:=True
        .AutoFilter Field:=4, visibledropdown:=False
        .AutoFilter Field:=5, visibledropdown:=True
    End With

End Sub

Sub AutoFilterDropdownsOFF()

    With Range("E5:I5")
'        .AutoFilter Field:=0, VisibleDropDown:=True
        .AutoFilter Field:=1, visibledropdown:=False
        .AutoFilter Field:=2, visibledropdown:=False
        .AutoFilter Field:=3, visibledropdown:=False
        .AutoFilter Field:=4, visibledropdown:=False
        .AutoFilter Field:=5, visibledropdown:=False
    End With

End Sub

Open in new window

REgards
0
 

Author Comment

by:hindersaliva
ID: 41850085
Rgonzo, nope!
Error
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41850090
You range is not the same as in the file

line 6 instead of 5
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now