ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign macro to check box? (https://www.excelbanter.com/excel-programming/436403-assign-macro-check-box.html)

munchkin

Assign macro to check box?
 
Is it possible to make my macro turn on the auto filter when checked, and
turn it off when unchecked?



Rows("3:3").Select
Selection.AutoFilter
Range("A4").Select
End Sub


FSt1

Assign macro to check box?
 
hi
if using a check box from the control tool box, this should work
auto filter is boolean meaning the same command that turns it on also turns
it off if it's on. i removed the select and selection parts...........not
needed.
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
'turn of
Rows("3:3").AutoFilter
Range("A4").Select
Else
'turn off
Rows("3:3").AutoFilter
Range("A4").Select
End If
End Sub

regards
FSt1

"Munchkin" wrote:

Is it possible to make my macro turn on the auto filter when checked, and
turn it off when unchecked?



Rows("3:3").Select
Selection.AutoFilter
Range("A4").Select
End Sub



All times are GMT +1. The time now is 12:04 PM.

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