复制粘贴值在VBA得到错误的粘贴值

  • 本文关键字:错误 复制 VBA excel vba
  • 更新时间 :
  • 英文 :


这是错误代码。请帮帮我。

Sub test()
Dim wsT As Worksheet 
With Workbooks("testing.xlsm") 
Set wsT = .Sheets("Sheet4") 
wsT.Cells(wsT.Rows.Count, "B").End(xlUp).Offset(1, 0).Resize(1, 3).Value =.Sheets("Sheet3").Range("A1:C1").Value 
Application.OnTime Now + TimeValue("00:00:10"), "test" 
End With 
End Sub

我尝试了这段代码,对我来说工作得很好(为了简单起见,我只更改了With ActiveWorkbook)。

Sub test()
Dim wsT As Worksheet
With ActiveWorkbook
Set wsT = .Sheets("Sheet4")
wsT.Cells(wsT.Rows.Count, "B").End(xlUp).Offset(1, 0).Resize(1, 3).Value = .Sheets("Sheet3").Range("A1:C1").Value
Application.OnTime Now + TimeValue("00:00:10"), "test"
End With
End Sub

如果出现错误,请检查工作表的确切名称(如果存在"Sheet4"one_answers"Sheet3"和一个名为"testing.xlsm"的工作簿。

最新更新