有趣的是,只有在 Excel 窗口中实际选择了工作表时,以下代码才有效。我真的很想尽快完成这个宏,但似乎无法弄清楚如何选择一个特定的工作表以便它在 excel 中打开?非常感谢,如果有人知道如何。我必须使用范围等。
sheet.Range(Cells(firstRow, 2).Address(False, False), Cells(lastRow, 50)).Select
With Selection
.Copy
End With
sheet.Range(Cells(firstRow, 3).Address(False, False), Cells(lastRow, 51)).Select
With Selection
.PasteSpecial xlPasteValuesAndNumberFormats
End With