我不知道这段代码有什么问题。它在 Rng.select 处显示错误。当我在单独的表格上进行测试时,它起作用了。有什么帮助吗?
Sub copyex()
Dim Lastro As Integer
Dim oSht As Worksheet
Dim Rng As Range
'make exact copy at S6 for comparasion
Set oSht = Workbooks("Main.xlsm").Sheets("Work")
Lastro = oSht.Cells(Rows.Count, 2).End(xlUp).Row
With oSht
Set Rng = oSht.Range("B6:G" & Lastro)
Rng.Select
Selection.Copy
Range("S6").Select
ActiveSheet.Paste
End With