+ Reply to Thread
Results 1 to 4 of 4

adding cell data into a macro to allow specified information filte

  1. #1
    mattguerilla
    Guest

    adding cell data into a macro to allow specified information filte


    I have a macro which filters information in a worksheet and then copies
    certain columns of the filtered data to another worksheet. The macro that
    does this already contains the filter criteria. What I would like to do is
    allow a user to type information into a given cell which the macro will read
    and use as the filter criteria (when the macro runs). Can this be done?

  2. #2
    JE McGimpsey
    Guest

    Re: adding cell data into a macro to allow specified information filte

    One way:


    Sheets("Sheet1").Range("A1").AutoFilter _
    Field:=1, _
    Criteria1:=Sheets("Sheet1").Range("J10").Value, _
    VisibleDropDown:=True



    Or, more efficiently:

    With Sheets("Sheet1")
    .Range("A1").AutoFilter, _
    Field:=1, _
    Criteria1:=.Range("J10").Value, _
    VisibleDropDown:=True
    End With





    In article <[email protected]>,
    mattguerilla <[email protected]> wrote:

    > I have a macro which filters information in a worksheet and then copies
    > certain columns of the filtered data to another worksheet. The macro that
    > does this already contains the filter criteria. What I would like to do is
    > allow a user to type information into a given cell which the macro will read
    > and use as the filter criteria (when the macro runs). Can this be done?


  3. #3
    Tom Ogilvy
    Guest

    Re: adding cell data into a macro to allow specified information filte

    Using Autofilter?

    instead of Criteria1:="ABC"

    put in

    Criteria1:=Worksheets(1).Range("E9").Value

    --
    Regards,
    Tom Ogilvy


    "mattguerilla" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have a macro which filters information in a worksheet and then copies
    > certain columns of the filtered data to another worksheet. The macro that
    > does this already contains the filter criteria. What I would like to do

    is
    > allow a user to type information into a given cell which the macro will

    read
    > and use as the filter criteria (when the macro runs). Can this be done?




  4. #4
    mattguerilla
    Guest

    Re: adding cell data into a macro to allow specified information f

    thankyou very much lads...excellent

    Matt

+ 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