A
Abhi
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:
Code:
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
user is selecting it.) in VBA. The code is as below:
Code:
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