我正在尝试复制从单元格A2开始的范围内容,然后将内容粘贴到单元格E7中。
当我的范围大约是100行时,这里写的代码一直在为我工作,但当我尝试使用更大的范围(200行)时,它只粘贴了大约70%的内容。
有没有办法解决这个问题,所以每次都有效?
Sub Copy_Paste()
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim rng As Range
Dim i As String
For Each rng In Selection
i = i & rng & " "
Next rng
Range("E7").Value = Trim(i)
答案 0 :(得分:0)
将这两项建议放在一起
Sub Copy_Paste()
Dim rng As Range
Dim i As String
For Each rng In range(Range("A2"),Range("A" & activesheet.rows.count).end(xlup))
i = i & rng.text & " "
Next rng
if len(i)>32387 then msgbox "Too Long" 'test if too long
Range("E7").Value = Trim(i)
End Sub