ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code to unfilter one field only (https://www.excelbanter.com/excel-programming/346054-code-unfilter-one-field-only.html)

scrabtree23[_3_]

Code to unfilter one field only
 
Here is my code:

Sheets("CEU Database").Select

If Sheets("Code").Range("L2").Value = "All" Then
'??? I need to unfilter Field: 1 only, and leave all other filtered
fields intact
Else
Cells.Select
Selection.AutoFilter Field:=1,
Criteria1:=Sheets("Code").Range("L2").Value
End If



Don Guillett[_4_]

Code to unfilter one field only
 
AFAIK you will have to unfilter all and re-apply a suitable filter.

--
Don Guillett
SalesAid Software

"scrabtree23" wrote in message
...
Here is my code:

Sheets("CEU Database").Select

If Sheets("Code").Range("L2").Value = "All" Then
'??? I need to unfilter Field: 1 only, and leave all other filtered
fields intact
Else
Cells.Select
Selection.AutoFilter Field:=1,
Criteria1:=Sheets("Code").Range("L2").Value
End If





Dave Peterson

Code to unfilter one field only
 
I put a little data on a worksheet.

I applied data|filter to that data. I filtered by both column 1 and column 2.
Then I turned on the macro recorder when I did "(All)" for the first field. I
got this back:

Selection.AutoFilter Field:=1



scrabtree23 wrote:

Here is my code:

Sheets("CEU Database").Select

If Sheets("Code").Range("L2").Value = "All" Then
'??? I need to unfilter Field: 1 only, and leave all other filtered
fields intact
Else
Cells.Select
Selection.AutoFilter Field:=1,
Criteria1:=Sheets("Code").Range("L2").Value
End If


--

Dave Peterson


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com