December 4, 2021
I have a VBA macro, which works. Now when the autofilter exists, but is showing ALL data or there is no autofilter present, the macro below goes to my sheet ("Owner_CAPA"), and applies the filter so that only "no" values are visibble in column U (21st column). Now what I would like to do, is revise this macro, so that if it currently displays only "No", and the macro button is pressed AGAIN, then it would go to "Show all data". I know how to do this in 2 seperate macros, however not as a "toggle"
Sub FilterRowsOwner()
' Sheet = "Owner_CAPA", Column = U/#21
Worksheets("Owner_CAPA").Range("U1").AutoFilter Field:=21, Criteria1:="No"
End Sub
Trusted Members
October 17, 2018
Hi Sherry,
Give this a try
Sub FilterRowsOwner()
' Sheet = "Owner_CAPA", Column = U/#21
Select case Worksheetfunction.CountA(Worksheets("Owner_CAPA").Range("U:U")) = Worksheetfunction.Count(Worksheets("Owner_CAPA").Range("U:U"))
Case = True
Worksheets("Owner_CAPA").Range("U1").AutoFilter Field:=21, Criteria1:="No"
Case elee
Worksheets("Owner_CAPA").Range("U1").AutoFilter Field:=21
End Select
End Sub
1 Guest(s)