在Excel中将数组转换为字符串

时间:2018-12-19 08:49:39

标签: excel-formula

我正在尝试将数组输出转换为字符串,以便以后进行操作和查看。

例如,我有一个数组{681120; 953160; 909420; 16300}。 我将如何将其转换为字符串?

1 个答案:

答案 0 :(得分:0)

尝试:

Option Explicit

Sub ArrayLoop()

    Dim ArrList As Variant
    Dim ArrItem As Variant
    Dim Result As String

    ArrList = Array("681120", "953160", "909420", "16300")

    Result = ""

    For Each ArrItem In ArrList
        If Result = "" Then
            Result = ArrItem
        Else: Result = Result & "_" & ArrItem
        End If
    Next

End Sub