+ Reply to Thread
Results 1 to 3 of 3

Automatic filtering keystroke

  1. #1
    DoctorG
    Guest

    Automatic filtering keystroke

    I'm wondering if there is a keystroke that automatically applies a filter
    according to the current cell contents.

    That is, if my current cell is i.e. C155 and its contents are "My Bank
    Expenses" and I want to filter out all lines with "My Bank Expenses" in
    column C, instead of clicking on the column header (C1) filter button to
    bring up the list box with all the values and then scroll all the way down to
    "My Bank Expenses", is there a Ctrl / Alt / whatever combination that would
    automatically apply the "My Bank Expenses" filter to column C according to
    the contents of the currently selected cell??

    Am I making sense here? I'm just looking for a shortcut.
    Or should I write a routine of some sort and link it to a button? (Anyone
    who is quick to say yes to the last question had better suggest some code as
    well!!!!)

    Thanks in advance

  2. #2
    Norman Jones
    Guest

    Re: Automatic filtering keystroke

    Hi DoctorG.

    Try assigning the following code to a button:

    '=============>>
    Public Sub Tester()
    Dim sStr As String

    sStr = ActiveCell.Value

    Range("A1").AutoFilter Field:=3, Criteria1:=sStr
    End Sub

    '<<=============

    ---
    Regards,
    Norman



    "DoctorG" <[email protected]> wrote in message
    news:[email protected]...
    > I'm wondering if there is a keystroke that automatically applies a filter
    > according to the current cell contents.
    >
    > That is, if my current cell is i.e. C155 and its contents are "My Bank
    > Expenses" and I want to filter out all lines with "My Bank Expenses" in
    > column C, instead of clicking on the column header (C1) filter button to
    > bring up the list box with all the values and then scroll all the way down
    > to
    > "My Bank Expenses", is there a Ctrl / Alt / whatever combination that
    > would
    > automatically apply the "My Bank Expenses" filter to column C according to
    > the contents of the currently selected cell??
    >
    > Am I making sense here? I'm just looking for a shortcut.
    > Or should I write a routine of some sort and link it to a button? (Anyone
    > who is quick to say yes to the last question had better suggest some code
    > as
    > well!!!!)
    >
    > Thanks in advance




  3. #3
    DoctorG
    Guest

    Re: Automatic filtering keystroke

    Norman thanks a lot.
    I am really in a hurry to try this out now but it looks simple enough. I
    will even modify the Field:=3 to account for other columns so that I can
    place this in Book.xls.


    "Norman Jones" wrote:

    > Hi DoctorG.
    >
    > Try assigning the following code to a button:
    >
    > '=============>>
    > Public Sub Tester()
    > Dim sStr As String
    >
    > sStr = ActiveCell.Value
    >
    > Range("A1").AutoFilter Field:=3, Criteria1:=sStr
    > End Sub
    >
    > '<<=============
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "DoctorG" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'm wondering if there is a keystroke that automatically applies a filter
    > > according to the current cell contents.
    > >
    > > That is, if my current cell is i.e. C155 and its contents are "My Bank
    > > Expenses" and I want to filter out all lines with "My Bank Expenses" in
    > > column C, instead of clicking on the column header (C1) filter button to
    > > bring up the list box with all the values and then scroll all the way down
    > > to
    > > "My Bank Expenses", is there a Ctrl / Alt / whatever combination that
    > > would
    > > automatically apply the "My Bank Expenses" filter to column C according to
    > > the contents of the currently selected cell??
    > >
    > > Am I making sense here? I'm just looking for a shortcut.
    > > Or should I write a routine of some sort and link it to a button? (Anyone
    > > who is quick to say yes to the last question had better suggest some code
    > > as
    > > well!!!!)
    > >
    > > Thanks in advance

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1