|
- Sub ykcbf() '//2025.3.28 电话号查询
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set fso = CreateObject("scripting.filesystemobject")
- Set ws = ThisWorkbook
- p = ws.Path & ""
- Set sh = ws.Sheets("Sheet1")
- xm = sh.[f2].Value
- ' On Error Resume Next
- Dim tm: tm = Timer
- For Each f In fso.GetFolder(p).Files
- If LCase$(f.Name) Like "*.xls*" Then
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- ft = 0
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets(1)
- Set Rng = .UsedRange.Find(What:=xm, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
- If Not Rng Is Nothing Then ft = 1
- End With
- wb.Close 0
- If ft = 1 Then
- MsgBox "电话号在" & f.Name & "文件中找到了!"
- Exit Sub
- End If
- End If
- End If
- Next f
- Application.ScreenUpdating = True
- MsgBox "共用时:" & Format(Timer - tm, "0.000") & "秒!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|