sgkdnay
Technical User
- Aug 4, 2008
- 21
I know there is a better way, I'm a self-learner. It works fine but takes TOO long to search thru the listview and compare each other and pulls new data listview from old data listview. Is there a better way to re-code this? Code as follows:
For x = 1 To ListView3.ListItems.Count
For y = 1 To ListView4.ListItems.Count
If ListView3.ListItems.Item(x).SubItems(1) = ListView4.ListItems.Item.SubItems(1) Then
NA1 = True
Exit For
Else
NA1 = False
End If
Form1.Caption = "Automated CRM Distribution - " & x & "/" & y
Next y
If NA1 = False Then
NRow = ListView5.ListItems.Count + 1
ListView5.ListItems.Add
ListView5.ListItems.Item(NRow).Text = NRow
ListView5.ListItems.Item(NRow).SubItems(1) = ListView3.ListItems.Item(x).SubItems(1)
ListView5.ListItems.Item(NRow).SubItems(2) = ListView3.ListItems.Item(x).SubItems(2)
ListView5.ListItems.Item(NRow).SubItems(3) = ListView3.ListItems.Item(x).SubItems(3)
NRowA = ListView9.ListItems.Count + 1
ListView9.ListItems.Add
ListView9.ListItems.Item(NRowA).Text = NRowA
ListView9.ListItems.Item(NRowA).SubItems(1) = ListView3.ListItems.Item(x).SubItems(1)
ListView9.ListItems.Item(NRowA).SubItems(2) = ListView3.ListItems.Item(x).SubItems(2)
ListView9.ListItems.Item(NRowA).SubItems(3) = ListView3.ListItems.Item(x).SubItems(3)
NA1 = True
End If
Do: DoEvents: Loop Until EOF(x)
Label9.Caption = "Fresh Leads (" & ListView9.ListItems.Count & ")"
Next x
For x = 1 To ListView3.ListItems.Count
For y = 1 To ListView4.ListItems.Count
If ListView3.ListItems.Item(x).SubItems(1) = ListView4.ListItems.Item.SubItems(1) Then
NA1 = True
Exit For
Else
NA1 = False
End If
Form1.Caption = "Automated CRM Distribution - " & x & "/" & y
Next y
If NA1 = False Then
NRow = ListView5.ListItems.Count + 1
ListView5.ListItems.Add
ListView5.ListItems.Item(NRow).Text = NRow
ListView5.ListItems.Item(NRow).SubItems(1) = ListView3.ListItems.Item(x).SubItems(1)
ListView5.ListItems.Item(NRow).SubItems(2) = ListView3.ListItems.Item(x).SubItems(2)
ListView5.ListItems.Item(NRow).SubItems(3) = ListView3.ListItems.Item(x).SubItems(3)
NRowA = ListView9.ListItems.Count + 1
ListView9.ListItems.Add
ListView9.ListItems.Item(NRowA).Text = NRowA
ListView9.ListItems.Item(NRowA).SubItems(1) = ListView3.ListItems.Item(x).SubItems(1)
ListView9.ListItems.Item(NRowA).SubItems(2) = ListView3.ListItems.Item(x).SubItems(2)
ListView9.ListItems.Item(NRowA).SubItems(3) = ListView3.ListItems.Item(x).SubItems(3)
NA1 = True
End If
Do: DoEvents: Loop Until EOF(x)
Label9.Caption = "Fresh Leads (" & ListView9.ListItems.Count & ")"
Next x