1
如何將A1到A5的值存儲到字符串「Content」中不僅是A5值?VBA在字符串中使用循環存儲值
i = 2
Do
Content = "Range("A" & i).Value"
i = i + 1
Loop Until i > 5
如何將A1到A5的值存儲到字符串「Content」中不僅是A5值?VBA在字符串中使用循環存儲值
i = 2
Do
Content = "Range("A" & i).Value"
i = i + 1
Loop Until i > 5
然後喲需要自己來連接它:
i = 2
Do
Content = Content & Range("A" & i).Value
i = i + 1
Loop Until i > 5
或者你可以試試這個:
Dim r As Range, Content As String
Set r = Range("A1:A5")
With Application
Content = VBA.Join(.Transpose(r), "")
Debug.Print Content
End With
無需循環。這是如果你只需要連接它。