您无法
在多个数组中重新绘制第一个维度,只能重新创建第二个
数组 以下是如何在删除重复后重新创建新数组的方法
:
- 'make sure you checked in Tools->Options->General->Error trapping->'Break on Unhandled Errors'
- Sub TestRemove_Dupes()
- Dim x(0 To 3) As Double, y(0 To 3) As Double
- x(0) = 0.29
- y(0) = 0.89
- x(1) = 0.34
- y(1) = 0.44
- x(2) = 0.29
- y(2) = 0.89
- x(3) = 0.12
- y(3) = 0.86
- Dim coll As New Collection
- Dim i, j
- Dim itm(0 To 1)
- For i = 0 To UBound(x)
- itm(0) = x(i): itm(1) = y(i)
- On Error Resume Next
- coll.Add itm, CStr(x(i)) & CStr(y(i))
- Next
- ReDim ar(0 To coll.Count - 1, 0 To 1)
- 'colllection items starts from 1
- For i = 1 To coll.Count
- ar(i - 1, 0) = coll.item(i)(0): ar(i - 1, 1) = coll.item(i)(1)
- Next
- For i = 0 To UBound(ar)
- Debug.Print ar(i, 0) & " | " & ar(i, 1)
- Next
- End Sub
|