|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub find()
Application.ScreenUpdating = False
Dim i As Integer
Set sh = ThisWorkbook.ActiveSheet
i = 2
f = Dir("E:\新建文件夹\*.xls*")
Do While f <> ""
If f <> ThisWorkbook.Name Then
Set wb = Workbooks.Open("E:\新建文件夹\" & f, 0)
With wb.Worksheets(1)
sh.Range("A" & i) = Split(f, ".")(0)
sh.Range("C" & i) = .Range("B2")
sh.Range("D" & i) = .Range("C2")
sh.Range("E" & i) = .Range("B3")
sh.Range("F" & i) = .Range("C3")
sh.Range("G" & i) = .Range("B4")
sh.Range("H" & i) = .Range("B4")
sh.Range("I" & i) = .Range("B4")
sh.Range("J" & i) = .Range("B4")
sh.Range("K" & i) = .Range("B4")
sh.Range("L" & i) = .Range("B4")
sh.Range("M" & i) = .Range("B4")
sh.Range("N" & i) = .Range("B4")
End With
wb.Close False
i = i + 1
End If
f = Dir
Loop
Application.ScreenUpdating = True
MsgBox "ok!", 64, "提醒"
End Sub |
|