如何将A1到A5的值存储到字符串“Content”中,而不仅仅是A5值
i = 2
Do
Content = "Range("A" & i).Value"
i = i + 1
Loop Until i > 5
答案 0 :(得分:1)
然后你需要将它与自身连接起来:
i = 2
Do
Content = Content & Range("A" & i).Value
i = i + 1
Loop Until i > 5
答案 1 :(得分:1)
或者你可以试试这个:
Dim r As Range, Content As String
Set r = Range("A1:A5")
With Application
Content = VBA.Join(.Transpose(r), "")
Debug.Print Content
End With
不需要循环。那就是你只需要连接它。