Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
with Sheets("XYZ") wSheet.Range("8:8,9:9,10:10,11:11,12:12,13:13,266:266,472:472").Copy .Cells(.Cells(.Cells.Rows.Count, 1).End(xlUp).Row + 1, 1).Select .Paste
为什么它不起作用,而是给我从 8 到 472 的所有行?我需要特定的行,而不是全部。
我可以按预期复制以下代码。这是在 Excel 2007 上 - 可能是您使用的是行为不同的早期版本。
Public Sub Test() With Sheets("XYZ") .Range("8:8,9:9,10:10,11:11,12:12,13:13,266:266,472:472").Copy .Cells(.Cells(.Cells.Rows.Count, 1).End(xlUp).Row + 1, 1).Select .Paste End With End Sub