【发布时间】:2015-02-03 22:37:33
【问题描述】:
考虑到我已经阅读了另一个线程解释“如何粘贴到第一个空白单元格”...here 我需要知道如何粘贴“价值”。 示例:
Dim sh As Worksheet, tCell As Range
Sheets("Lunch Extend").Range("B4:F31").Copy
Set sh = Sheets("Backup")
Set tCell = FreeCell(sh.Range("B3"))
sh.Paste PasteSpecial xlValues tCell
但是,最后一行没有正确读取。有什么帮助吗?
sh.Paste tCell
...有效,但我需要价值观。谢谢。
在此处添加 FreeCell 功能...
Function FreeCell(r As Range) As Range
' returns first free cell below r
Dim lc As Range ' last used cell on sheet
Set lc = r.Offset(1000, 0).End(xlUp).Offset(1, 0)
Set FreeCell = lc
End Function
【问题讨论】:
-
Sheet.PasteSpecial 方法的语法不正确,但使用 Range.PasteSpecial 方法可能更简单。请参阅 VBA 帮助以正确使用这些方法。
标签: excel vba cell copy-paste next