Excel VBA:运行时错误'''对象不支持

时间:2018-05-27 10:49:22

标签: excel vba excel-vba

请帮助调试:Run-time error '438' Object doesn't support this property or method
对于此代码将值从工作簿复制到另一个,我昨天这样做,但我忘了保存,我今天尝试,但它没有工作

Sub Listcustomer()

    Dim y As Workbook
    Dim x As Workbook

    Set y = ActiveWorkbook
    Set x = Workbooks.Open("\\myNetworkSharePath\myFileName.xlsx")

    For i = 1 To x.Sheets.Count
        y.ActiveSheet.Range("d" & i + 3).Value = x.Sheet(i).Range("b3").Value
    Next i

End Sub

1 个答案:

答案 0 :(得分:4)

错字。将表格更改为表格

 y.ActiveSheet.Range("d" & i + 3).Value = x.Sheets(i).Range("b3").Value