|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 zyg365 于 2013-3-26 17:22 编辑
zhaogang1960 发表于 2013-3-26 15:59
采用上面二位老师的思路,如果不合题意,请楼主上传附件说明:
修改一下:更详细,单元格地址——工作簿 工作表 单元格地址
Sub Macro1()
Dim p$, f$, sh As Worksheet, c As Range, arr$(1 To 10000, 1 To 3), m&
Application.ScreenUpdating = False
p = ThisWorkbook.Path & "\"
f = Dir(p & "*.xls")
Do While f <> ""
If f <> ThisWorkbook.Name Then
With GetObject(p & f)
For Each sh In .Sheets
Set c = sh.UsedRange.Find("zyg", , , 1)
If Not c Is Nothing Then
m = m + 1
arr(m, 1) = f
arr(m, 2) = sh.Name
arr(m, 3) = c.Address
End If
Next
.Close False
End With
End If
f = Dir
Loop
Cells.ClearContents
Application.ScreenUpdating = True
If m > 0 Then
[a1:c1] = Array("工作簿", "工作表", "单元格地址")
[a2].Resize(m, 3) = arr
Else
MsgBox "没有查到符合条件的工作表"
End If
End Sub
|
|