phobia
Terugkerende gebruiker
- Lid geworden
- 4 sep 2006
- Berichten
- 1.777
Ik heb een excel sheet welke ik filter op datum.
Dit lukt, maar nu wil ik de gefilterde gegevens gaan gebruiken in een listview.
en dat krijg ik dus niet voor elkaar
mijn code
[CPP]
Dim found As Excel.Range
oSheet.AutoFilterMode = False
oSheet.Range("A1:U1").AutoFilter(Field:=3, Criteria1:=">=" & FdateIn, Operator:=Excel.XlAutoFilterOperator.xlAnd, Criteria2:="<=" & FdateOut)
found = oSheet.UsedRange
Dim lRow As Long = 0
With found
lRow = .Range("A" & .Rows.Count).End(Excel.XlDirection.xlUp).Row
End With
MessageBox.Show("The last row in Col A of Sheet1 which has data is " & lRow)
Do Until (found.Cells(tel, 1) Is Nothing)
Dim listItem As ListViewItem = New ListViewItem(oSheet.Cells(tel, 1).value.ToString)
If (Not found.Cells(tel, 16).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 16).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 17).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 17).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 18).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 18).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 5).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 5).value.ToString) Else listItem.SubItems.Add("")
Lv_multiview.Items.Add(listItem)
Main.ToolStripProgressBar1.Value = tel
Main.ToolStripStatusLabel2.Text = "Loading: " & tel
tel += 1
Loop
[/CPP]
Als iemand mijn weer een zetje kan geven, zit er al 3 dagen op te klungelen
Dit lukt, maar nu wil ik de gefilterde gegevens gaan gebruiken in een listview.
en dat krijg ik dus niet voor elkaar
mijn code
[CPP]
Dim found As Excel.Range
oSheet.AutoFilterMode = False
oSheet.Range("A1:U1").AutoFilter(Field:=3, Criteria1:=">=" & FdateIn, Operator:=Excel.XlAutoFilterOperator.xlAnd, Criteria2:="<=" & FdateOut)
found = oSheet.UsedRange
Dim lRow As Long = 0
With found
lRow = .Range("A" & .Rows.Count).End(Excel.XlDirection.xlUp).Row
End With
MessageBox.Show("The last row in Col A of Sheet1 which has data is " & lRow)
Do Until (found.Cells(tel, 1) Is Nothing)
Dim listItem As ListViewItem = New ListViewItem(oSheet.Cells(tel, 1).value.ToString)
If (Not found.Cells(tel, 16).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 16).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 17).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 17).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 18).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 18).value.ToString) Else listItem.SubItems.Add("")
If (Not found.Cells(tel, 5).value = Nothing) Then listItem.SubItems.Add(found.Cells(tel, 5).value.ToString) Else listItem.SubItems.Add("")
Lv_multiview.Items.Add(listItem)
Main.ToolStripProgressBar1.Value = tel
Main.ToolStripStatusLabel2.Text = "Loading: " & tel
tel += 1
Loop
[/CPP]
Als iemand mijn weer een zetje kan geven, zit er al 3 dagen op te klungelen