I have multiple values that I'm reading into an array, but I need to paste those values into a single cell comma separated. Is this possible?
我有多个值,我正在读取数组,但我需要将这些值粘贴到单个单元格逗号分隔。这可能吗?
1 个解决方案
#1
3
You can Join
an array with a given separator
您可以使用给定的分隔符加入数组
myArray = Array("John","Bob","Mary")
sString = Join(myArray, ",")
msgbox sString
Will give you "John,Bob,Mary" in sString...
将在sString中给你“John,Bob,Mary”......
To put this into a cell: Worksheets("Sheet1").Range("A1").Value = sString
将它放入单元格:工作表(“Sheet1”)。范围(“A1”)。值= sString
#1
3
You can Join
an array with a given separator
您可以使用给定的分隔符加入数组
myArray = Array("John","Bob","Mary")
sString = Join(myArray, ",")
msgbox sString
Will give you "John,Bob,Mary" in sString...
将在sString中给你“John,Bob,Mary”......
To put this into a cell: Worksheets("Sheet1").Range("A1").Value = sString
将它放入单元格:工作表(“Sheet1”)。范围(“A1”)。值= sString