EXCEL表格中每行重复值只保留一个

谢谢你昨天回答我的问题,如果是45列该如何修改呢?
Sub qcf()
Dim d
Set d = CreateObject("Scripting.Dictionary")
Dim i, j, r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To r
For j = 1 To 10
d(Cells(i, j).Value) = ""
Next
Range("L" & i).Resize(1, d.Count) = d.keys
d.RemoveAll
Next
Set d = Nothing
End Sub

十列的是这个,如果是45列该如何修改呢

Sub qcf()
Dim d
Set d = CreateObject("Scripting.Dictionary")
Dim i, j, r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To r
    For j = 1 To 45
        d(Cells(i, j).Value) = ""
    Next
    Range("AU" & i).Resize(1, d.Count) = d.keys
    d.RemoveAll
Next
Set d = Nothing
End Sub

温馨提示:答案为网友推荐,仅供参考
相似回答