Hi There --
I have a list of 4 values ("Auto", "Multi", "Tech", "Lifestyle") in a data validation list (cell I3, Sheet = "Opportunities"). I'd like the macro below to run / pull data based on that selection. Right now the macro searches through the Raw Data and pulls each of the categories one at a time. I want it to pull based on cell I3 in the current sheet.
Sorry in advance if this is a dumb question - I am still learning VBA and am new! Thank you for your help!
Sub Opportunities()
'
' Opportunities Macro
' Clear Data from Sheet
Sheets("Opportunities").Cells.Clear
' Filter Seller POD
Dim ary As Variant
Dim i As Long
ary = Array("Auto", "Multi", "Tech", "Lifestyle")
For i = 0 To UBound(ary)
With Sheets("Raw Data")
If .AutoFilterMode Then .AutoFilterMode = False
With .Range("A1:W1")
.AutoFilter 11, ">=" & 75
.AutoFilter 19, ary(i)
End With
Intersect(.AutoFilter.Range, .Range("A:A,C:C,S:S")).Copy Sheets("Opportunities").Range("A1")
.AutoFilterMode = False
End With
Next i
End Sub
I have a list of 4 values ("Auto", "Multi", "Tech", "Lifestyle") in a data validation list (cell I3, Sheet = "Opportunities"). I'd like the macro below to run / pull data based on that selection. Right now the macro searches through the Raw Data and pulls each of the categories one at a time. I want it to pull based on cell I3 in the current sheet.
Sorry in advance if this is a dumb question - I am still learning VBA and am new! Thank you for your help!
Sub Opportunities()
'
' Opportunities Macro
' Clear Data from Sheet
Sheets("Opportunities").Cells.Clear
' Filter Seller POD
Dim ary As Variant
Dim i As Long
ary = Array("Auto", "Multi", "Tech", "Lifestyle")
For i = 0 To UBound(ary)
With Sheets("Raw Data")
If .AutoFilterMode Then .AutoFilterMode = False
With .Range("A1:W1")
.AutoFilter 11, ">=" & 75
.AutoFilter 19, ary(i)
End With
Intersect(.AutoFilter.Range, .Range("A:A,C:C,S:S")).Copy Sheets("Opportunities").Range("A1")
.AutoFilterMode = False
End With
Next i
End Sub