我有很多行需要编辑。我想为此使用VBA,但是我不知道如何查找和删除行之间的重复项。
例如,我想把这个变成:
00122 | Gilera | DNA | DNA | Runner | VXR | Runner | FXR | 180 | 50 | 125 | 50
入这个
00122 | Gilera | DNA | Runner | VXR | FXR | 180 | 50 | 125
有人知道如何做到这一点吗?
此致!
Function testDupes(strInput As String, strDelimiter As String) As String
Dim intRow As Integer
Dim intCol As Integer
Dim arrSplit() As String
Dim dicCompare As New Scripting.Dictionary
Dim intCounter As Integer
arrSplit = Split(strInput, strDelimiter)
For intCounter = 0 To UBound(arrSplit)
If Not dicCompare.Exists(CStr(arrSplit(intCounter))) Then
dicCompare.Add CStr(arrSplit(intCounter)), CStr(arrSplit(intCounter))
End If
Next intCounter
For intCounter = 0 To dicCompare.Count - 1
testDupes = testDupes & dicCompare.Keys()(intCounter) & _
IIf(intCounter < dicCompare.Count, strDelimiter, "")
Next intCounter
Set dicCompare = Nothing
End Function
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句