|
Sub Find()
Dim arr As Range, i As Integer, pth As String
Set Fso = CreateObject("scripting.filesystemobject")
pth = ThisWorkbook.Path
Set ff = Fso.getfolder(pth)
For Each f In ff.Files
If InStr(Split(f.Name, ".")(UBound(Split(f.Name, "."))), "xl") > 0 Then
If f.Name <> ThisWorkbook.Name Then
Set wb = Workbooks.Open(f)
For Each sht In wb.Sheets
If sht.Name = "BOM" Then
If WorksheetFunction.CountA(sht.UsedRange) > 1 Then
For i = 6 To Range("D:D").Rows.counts
If Range(i, "D").v = "贴片电感" Or Range(i, "D").Value = "功率电感" Then
arr(i) = Range(Cells(i, "C"), Cells(i, "E"))
End If
Next i
End If
End If
Next
End If
End If
Next
If Not arr Is Nothing Then arr.Copy
ThisWorkbook.Worksheets(1).Range("A1").Paste
End Sub
求大神指示这段代码错在哪???
|
-
错误提示
|