考虑到我已经阅读了另一个解释"如何粘贴到第一个空格" ... 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
答案 0 :(得分:1)
假设FreeCell
是您编写的函数并且它有效。试试这个:
Dim sh As Worksheet, tCell As Range
Sheets("Lunch Extend").Range("B4:F31").Copy
Set sh = Sheets("Backup")
Set tCell = FreeCell(sh.Range("B3"))
tCell.PasteSpecial Paste:=xlPasteValues