EXCEL VBA函数问题,高手来帮忙!

2024-11-25 07:50:13
推荐回答(3个)
回答1:

Function mcqc(rng As Range)
    Set d = CreateObject("Scripting.Dictionary")
    For Each a In rng
       d(a.Value) = ""
    Next
    mcqc = Join(d.keys, ";")
End Function

=MCQC(区域)

回答2:

在B1列中生成一个数组?能办到吗。如果B1中得到图中一样的字符串倒是不难

回答3:

Sub tests()
Dim rst As String
rst = "{" & Cells(1, 1) & ";"
i = 2
Do While Cells(i, 1) <> ""
If Len(rst) = Len(Replace(rst, Cells(i, 1), "")) Then
rst = rst & Cells(i, 1) & ";"
End If
i = i + 1
Loop
rst = Left(rst, Len(rst) - 1)
rst = rst & Cells(i, 1) & "}"
Cells(1, 2) = rst
End Sub