Hello all,
I have the following code below, I want to be able to set some kind of autofilter on the drop down box to show only the given part number of "217230*".
I tried including it in the Criteria1: field but did not work. I only want to see the part numbers "217230*" when you click on the drop down.
Private Sub ComboBox1_Change()
Sheets("RITE AID").Range("p1:z2000").ClearContents
uf1.Caption = Me.ComboBox1.Text
Application.ScreenUpdating = False
Sheets("BOM").ListObjects("Table_BoM_Report___mi").Range.Copy
Sheets("TRANS").Range("A1").PasteSpecial xlPasteValues
Set src = Sheets("TRANS").Range("A1").CurrentRegion
Set ws = Sheets("TRANS")
ws.ListObjects.Add(SourceType:=xlSrcRange, Source:=src, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium6").Name = "Table2"
Set rtf = Sheets("TRANS").ListObjects("Table2").Range
rtf.AutoFilter field:=1, Criteria1:=Me.ComboBox1.Value
For Each Row In Range("Table2[#All]").Rows
If Row.EntireRow.Hidden = False Then
If rng Is Nothing Then Set rng = Row
Set rng = Union(Row, rng)
End If
Next Row
Set ws = Sheets("RITE AID")
rng.Copy Destination:=ws.Range("P1")
Set src = ws.Range("P1").CurrentRegion
ws.ListObjects.Add(SourceType:=xlSrcRange, Source:=src, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium6").Name = "Table3"
Me.ListBox1.Clear
With Me.ListBox1
.List = Sheets("RITE AID").ListObjects("Table3").DataBodyRange.Value
.ColumnCount = 6
.ColumnWidths = "0,0,0,70,150,20"
End With
Sheets("RITE AID").Range("P1:z2000").ClearContents
Sheets("RITE AID").Range("p1:z2000").Clear
Sheets("RITE AID").Range("P1:Z2000").Interior.ColorIndex = 2
Application.ScreenUpdating = True
End Sub
Thank you to all who respond,
BLD
I have the following code below, I want to be able to set some kind of autofilter on the drop down box to show only the given part number of "217230*".
I tried including it in the Criteria1: field but did not work. I only want to see the part numbers "217230*" when you click on the drop down.
Private Sub ComboBox1_Change()
Sheets("RITE AID").Range("p1:z2000").ClearContents
uf1.Caption = Me.ComboBox1.Text
Application.ScreenUpdating = False
Sheets("BOM").ListObjects("Table_BoM_Report___mi").Range.Copy
Sheets("TRANS").Range("A1").PasteSpecial xlPasteValues
Set src = Sheets("TRANS").Range("A1").CurrentRegion
Set ws = Sheets("TRANS")
ws.ListObjects.Add(SourceType:=xlSrcRange, Source:=src, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium6").Name = "Table2"
Set rtf = Sheets("TRANS").ListObjects("Table2").Range
rtf.AutoFilter field:=1, Criteria1:=Me.ComboBox1.Value
For Each Row In Range("Table2[#All]").Rows
If Row.EntireRow.Hidden = False Then
If rng Is Nothing Then Set rng = Row
Set rng = Union(Row, rng)
End If
Next Row
Set ws = Sheets("RITE AID")
rng.Copy Destination:=ws.Range("P1")
Set src = ws.Range("P1").CurrentRegion
ws.ListObjects.Add(SourceType:=xlSrcRange, Source:=src, xlListObjectHasHeaders:=xlYes, tablestyleName:="TableStyleMedium6").Name = "Table3"
Me.ListBox1.Clear
With Me.ListBox1
.List = Sheets("RITE AID").ListObjects("Table3").DataBodyRange.Value
.ColumnCount = 6
.ColumnWidths = "0,0,0,70,150,20"
End With
Sheets("RITE AID").Range("P1:z2000").ClearContents
Sheets("RITE AID").Range("p1:z2000").Clear
Sheets("RITE AID").Range("P1:Z2000").Interior.ColorIndex = 2
Application.ScreenUpdating = True
End Sub
Thank you to all who respond,
BLD
Last edited: