|
- Sub CopyData()
- Dim wsSource As Worksheet, wsTarget As Worksheet
- Dim rngSource As Range, rngTarget As Range
- Dim nextRow As Long
- Set wsSource = ThisWorkbook.Sheets("AAA") '请问上仙,不用名字定义表格,用默认表名,怎么写VBAProject Sheet1(AAA)
- Set wsTarget = ThisWorkbook.Sheets("BBB") '请问上仙,不用名字定义表格,用默认表名,怎么写VBAProject Sheet2(BBB)
- Set rngSource = wsSource.Range("CN23:DE23")
- nextRow = wsTarget.Cells(Rows.Count, "AB").End(xlUp).Row + 1
- Set rngTarget = wsTarget.Range("K" & nextRow & ":AB" & nextRow)
- rngSource.Copy
- rngTarget.PasteSpecial Paste:=xlPasteValues
- Application.CutCopyMode = False
- MsgBox "已写到 《BBB》。"
- End Sub
复制代码
|
|