I have selected a range which I want to display on Combo Box. The code is as followed.
Sheet5.Activate
ActiveSheet.ListObjects("Table6").Range.AutoFilter Field:=1, Criteria1:= _
"=*E*", Operator:=xlAnd
Range("A1").Select
ActiveCell.Offset(1, 2).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Without changing the above code, is there a way to change the below code to select the Selection.Copy
?
or is there a way to change the Range(Selection, Selection.End(xlDown))
portion to above Selection.Copy
?
With cbE
Me.cbE.List = Worksheets("EMP").Range(Selection, Selection.End(xlDown)).Value
End With
How do I filter out rows (based on the 1st column containing a specific text) from a table and display filtered column (4th filtered column) on combo box?
Update
With Sheet4
Dim lastRow As Long
lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
Dim filterRange As Range
Set filterRange = .Range("A2:A" & lastRow)
With filterRange
.AutoFilter 1, "E"
Dim filterE As Range
Set filterE = .Range("A1:A" & lastRow).Columns(5).SpecialCells(xlCellTypeVisible)
End With
End With
Me.cbE.List = Worksheets("EMP&Customers").Range(filterE, filterE.End(xlDown)).Value
above is the latest code I have and it works fine except that any cells between the first and last filtered cell will also be visible on the combobox.