filtering with a macro button

bvanscoy678

New Member
Joined
Jul 31, 2010
Messages
15
Hello,

I don't know a lot about macro's but gonna try to pull this off.

What I want to do is insert the macro button,
then assign it to filter by AM, PM (the shift column) and also a button for clear all. I have 5-6 of these areas on a sheet, so can't use just filter. Plus some guys that are using, really don't know anything about excel, so thought I button would work good.

I have done marco stuff, but not sure how to assign it a range and set the criteria. Any ideas, links or previous projects would be greatly appreciated.

2aa0vpc.jpg



thanks
Brent
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Is there anything else you want to do apart from sorting the table by AM/PM?
If so please state it...thanks

Do you mean sorting the table by AM or PM?
if you click on AM all the am will be in TOP region and if PM then PM?
What do you want to clear off when you click on the 3rd button
pedie
 
Last edited:
Upvote 0
:biggrin:
macro 1 is to filter by am
macro 3 is to file by pm
macro 2 is to remove

place the code in the command button accordingly and it should work...

hope this help
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
    Range("A4").Select
    Selection.CurrentRegion.Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$3:$H$16").AutoFilter Field:=5, Criteria1:="am"
    Range("A3").Select
End Sub
---------------
Sub Macro3()
'
' Macro1 Macro
'
'
    Range("A4").Select
    Selection.CurrentRegion.Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$3:$H$16").AutoFilter Field:=5, Criteria1:="pm"
    Range("A3").Select
End Sub
 
 
-----------
Sub Macro2()
Range("A4").Select
    Selection.CurrentRegion.Select
    Selection.AutoFilter
 range("A1").select
 
End Sub
 
Upvote 0
Yes, I am going to filter by AM or PM. So if I only want to see the AM shift or PM shift.

I'll try the first code for the macro.

Thank you
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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