![]() |
Can I put few buttons on an excell worksheet to filter according .
I would like to have few buttons ment for filtering the data in a worksheet,
with a given criteria which could be required frequently. Instead of filtering every time, it would be useful to have few buttons. |
Can I put few buttons on an excell worksheet to filter according .
hi,
yes you can. from the tool box, drag a command button to your sheet. right click and select properties. give it a name. maybe your filter. close the property window. Right click the button and select view code. it should have sub with the click event and end sub. paste this between the sub and end sub Range("A1").Select Range("A1").AutoFilter Range("A1").AutoFilter Field:=X, Criteria1:="YourCriteria" first line -the curser has to be within the data range hence A1 select or this fails. the second line turns autofilter on. the third line is the filter where field=X is the column count number. instead of A,B,C,D... use column numbers 1,2,3,4, ect. you can to a double filter. just add a fourth line with the column number and criteria. You may want an "unfilter" button. autofilter is boolean meaning on or off. if autofilter is on, the code to turn it off would simple be... Range("A1").autofilter if autofilter is off, the above command turns in on. if it is on, the above command turns it off. for more info, open the VB editor(Alt+F11) and click helptype autofilter hope is helped Regards FSt1 "Jazim" wrote: I would like to have few buttons ment for filtering the data in a worksheet, with a given criteria which could be required frequently. Instead of filtering every time, it would be useful to have few buttons. |
All times are GMT +1. The time now is 10:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com