+ Reply to Thread
Results 1 to 1 of 1

AutoFilter Criteria in VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    07-27-2006
    Posts
    19

    AutoFilter Criteria in VBA

    Hi,

    I am not able to set the criteria in a autofilter to be dynamic (i.e as the user is selecting it.) in VBA. The code is as below:
    
    Sub filt2()
    '
    ' filt2 Macro
    ' Macro recorded 4/23/2007 by Abhijit
    '
    
    '
        Dim engcode As Range, product As Range, quotetype As Range
        Set engcode = ThisWorkbook.Worksheets("a").Range("a1")
        Set product = ThisWorkbook.Worksheets("a").Range("a2")
        Set quotetype = ThisWorkbook.Worksheets("a").Range("a3")
        Sheets("Raw").Select
        Selection.AutoFilter
        Selection.AutoFilter
        Selection.AutoFilter Field:=13, Criteria1:=engcode.Value
        Selection.AutoFilter Field:=2, Criteria1:=product.Value
        Selection.AutoFilter Field:=4, Criteria1:=quotetype.Value
        Selection.AutoFilter Field:=8, Criteria1:="Jan"
        Sheets("Raw").Select
        Range("A1").Select
        ActiveCell.FormulaR1C1 = "=SUBTOTAL(102,R[1]C:RC)"
        Range("A1").Select
        Selection.Copy
        Sheets("a").Select
        Range("F14").Select
        ActiveSheet.Paste
        Application.CutCopyMode = False
        Selection.ClearContents
        Sheets("Raw").Select
        Selection.Copy
        Sheets("a").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End Sub
    Any suggestions.

    Please help

    Abhi
    Last edited by mudraker; 04-23-2007 at 07:49 AM.

+ 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