excel vba保留内容删除重复
发布网友
发布时间:2022-04-20 15:40
我来回答
共1个回答
热心网友
时间:2023-07-05 17:40
Sub s()
arr = [u39:t145689]
Set d = CreateObject("scripting.dictionary")
x = 1
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
If arr(i, j) <> "" Then
If d.exists(arr(i, j)) Then
arr(i, j) = ""
Else
d.Add arr(i, j), ""
y = y + 1
If y > UBound(arr, 2) Then y = 1: x = x + 1
If x <> i Or y <> j Then
arr(x, y) = arr(i, j)
arr(i, j) = ""
End If
End If
End If
Next j, i
[u39:t145689] = arr
End Sub
来自:求助得到的回答