1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
' get the excel used range
Dim range As Excel.Range = xlWorkSheet.UsedRange
Dim c1 As Integer = 1
Dim c2 As Integer = 100
' filter based on the combobox
' get the now visible cells from the filtering
With range
.AutoFilter(1, ">=" & c1, Excel.XlAutoFilterOperator.xlAnd, "<=" & c2)
.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing)
End With
Dim col As String = "B"
For row As Integer = 1 To range.Count
Dim elemValue As String = range.Range(col & row).Text
ListBox1.Items.Add(elemValue)
Next |
Partager