|
你的工作表名改来改去的,免得改代码,你在d1单元格输入要查询的工作表名,再运行代码:
Sub test4()
Dim arr(1 To 1000, 1 To 2)
Application.ScreenUpdating = False
p = ThisWorkbook.Path & "\"
f = Dir(p & "*.xls*")
Do While f <> ""
If f <> ThisWorkbook.Name Then
Set wb = GetObject(p & f)
m = m + 1
arr(m, 1) = Split(f, ".")(0)
For Each sht In wb.Sheets
If InStr(sht.Name, [d1]) Then n = n + 1
If n > 0 Then
arr(m, 2) = "存在"
Else
arr(m, 2) = "不存在"
End If
Next
Workbooks(f).Close False
End If
f = Dir
Loop
[a2].CurrentRegion.Offset(1).ClearContents
[a3].Resize(m, 2) = arr
Application.ScreenUpdating = True
End Sub
|
|