【发布时间】:2018-02-22 20:53:00
【问题描述】:
很抱歉,如果这已经讨论过了,我正在为需要复制和粘贴的范围的语法而苦苦挣扎。我试图在不使用剪贴板的情况下这样做,并发现我可以使用 .Value = .Value (Excel VBA Copy and Paste (without using Copy+Paste functions) on empty row) 来做到这一点
有两个工作簿,我从wbsource.Worksheets(1)复制到wb1.ws
参数是 - 如果列 L&row 有一个 "Yes" 则 ... 例如如果 L5 等于 Yes,则复制 A5:L5 并粘贴到 wb1.ws 的第一个空行中。
我的部分代码是
If .Cells(rw, 12) = "Yes" Then
Dim lastrw As Long
lastrw = ws.Cells(ws.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
wbsource.Worksheets(1).???? = ws.Range("A" & lastrw).Value
End If
如果你能帮助我了解这个语法,我将不胜感激
【问题讨论】:
-
应该是
destination.Value = source.Value,其中destination和source是您选择的范围。所以你需要左右翻转你的代码。 -
`ws.Range("A" & lastrw & ":L" & lastrw).Value=wbsource.sheets(1).range("A" & rw & ":L" & rw ).值