VBA:复制单元格,直到找到空单元格1004

时间:2018-08-16 21:13:18

标签: excel vba excel-vba

我要从Workbook IID.xlsm的E列中复制值,直到找到一个空单元格。并将它们粘贴到Placeholder.xlsm列A中。

我有以下代码,但在第三行出现错误

Dim cnt As Long 'add this to your declarations area
With Workbooks("IID.xls").Sheets("Outage Request List")
    cnt = .Range("A5", .Cells(Rows.Count, 2).End(xlUp)).Rows.Count
    Workbooks("Placeholder.xlsm").Sheets("Sheet1").Range("E5").Resize(cnt).Value = _
    .Range("A5", .Cells(Rows.Count, 2).End(xlUp)).Value
End With

错误1004:应用程序定义的错误或对象定义的错误

0 个答案:

没有答案