check box "when checked" filter this, if "not checked" reset filter

rapitorres

New Member
Joined
Oct 5, 2017
Messages
39
Office Version
  1. 2010
Platform
  1. Windows
Hi I already done this by using Macro. it works but then the problem is even if uncheck its still filters. By clicking it again whether its check or not it will just filter

here is my macro code
Sub SFR_Click()
Worksheets("ORDER REPORT LAZADA").Range("A5").AutoFilter Field:=12, Criteria1:="SFR"
End Sub

now I'm trying to implement it in VBA
here's what I got

on checkbox1

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then Worksheets("ORDER REPORT LAZADA").Range("A5").AutoFilter Field:=12, Criteria1:="SFR"
If CheckBox1.Value = False Then Range("LAZADA[[#Headers],[ORDER ID]]").Select.AutoFilter

End If
End Sub

And yup. not working
anyone :)
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Can be done like this:

VBA Code:
Private Sub CheckBox1_Click()
With ActiveSheet
    If CheckBox1.Value = True Then
        .ListObjects("LAZADA").Range.AutoFilter Field:=12, Criteria1:="SFR"
    Else
        .ListObjects("LAZADA").Range.AutoFilter Field:=12
    End If
End With
End Sub
 
Upvote 0
Solution
I almost got it right. thankyou for saving me lots of clicking. works like a charm, Appreciated :)
 
Upvote 0

Forum statistics

Threads
1,214,619
Messages
6,120,550
Members
448,970
Latest member
kennimack

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