12345467 |
12345467 |
12345467 |
12345555 |
12345467 |
12347777 |
12348888 |
12345555 |
12346677 |
12345467 |
12346677 |
and need to convert it to this |
12345467/1/5 |
12345467/2/5 |
12345467/3/5 |
12345555/1/2 |
12345467/4/5 |
12347777 |
12348888 |
12345555/2/2 |
12346677/1/2 |
12345467/5/5 |
12346677/2/2 |
Private Sub Command1_Click()
Dim colLI As New Collection
Dim lngEntry As Long
Dim lngList As Long
Dim lngMatch As Long
Dim intCount As Integer
Dim intTot As Integer
For lngEntry = 0 To List1.ListCount - 1
On Error Resume Next
colLI.Add List1.List(lngEntry), CStr(List1.List(lngEntry))
On Error GoTo 0
Next
For lngEntry = 1 To colLI.Count
' How many match
For lngMatch = 1 To colLI.Count
intTot = 0
For lngList = 0 To List1.ListCount - 1
If List1.List(lngList) = colLI(lngEntry) Then
intTot = intTot + 1
End If
Next
Next
' Markup with counts
If intTot > 1 Then
intCount = 0
For lngList = 0 To List1.ListCount - 1
If InStr(1, List1.List(lngList), colLI(lngEntry)) > 0 Then
intCount = intCount + 1
List1.List(lngList) = colLI(lngEntry) & "/" & intCount & "/" & intTot
End If
Next
End If
Next
End Sub
ASKER
ASKER
Private Sub Command1_Click()
Dim colLI As New Collection
Dim lngEntry As Long
Dim lngList As Long
Dim lngMatch As Long
Dim intCount As Integer
Dim intTot As Integer
Dim intCounts() As Integer
For lngEntry = 0 To List1.ListCount - 1
On Error Resume Next
colLI.Add List1.List(lngEntry), CStr(List1.List(lngEntry))
On Error GoTo 0
Next
ReDim intCounts(1 To colLI.Count)
For lngEntry = 1 To colLI.Count
' How many match
intTot = 0
For lngList = 0 To List1.ListCount - 1
If List1.List(lngList) = colLI(lngEntry) Then
intTot = intTot + 1
End If
Next
intCounts(lngEntry) = intTot
Next
' Markup with counts
For lngEntry = 1 To colLI.Count
intCount = 0
For lngList = 0 To List1.ListCount - 1
If List1.List(lngList) = colLI(lngEntry) Then
intCount = intCount + 1
List1.List(lngList) = colLI(lngEntry) & "/" & intCount & "/" & intCounts(lngEntry)
End If
Next
Next
End Sub
ASKER
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.
TRUSTED BY