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.




thanks
Brent
 
Last edited:

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
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:

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
: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
 

bvanscoy678

New Member
Joined
Jul 31, 2010
Messages
15
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,296
Messages
5,510,458
Members
408,791
Latest member
bwirth

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top