|
Sub DFDF()
Application.ScreenUpdating = False
p = ThisWorkbook.Path & "\"
D = Split("M2 D10 F10 H10 J10 M10 O10 Q10 S10")
n = 4
For Each File In CreateObject("Scripting.FilesyStemObject").GetFolder(ThisWorkbook.Path & "/").Files
If File.Name <> ThisWorkbook.Name And Left(File.Name, 1) <> "~" And File.Name Like "*.xls*" Then
For K = 0 To UBound(D)
T$ = "='" & p & "[" & File.Name & "]" & "成绩学分登记表'!" & Range(D(K)).Address(, , xlR1C1)
Range(Chr(K + 65) & n) = Vi(T, Chr(K + 65) & n)
Next
End If
n = n + 1
Next
Application.ScreenUpdating = True
End Sub
Function Vi(T$, G$)
Range(G) = T
Vi = Range(G).Value
End Function
Sub 提取英语数据()
Dim wb As Workbook
Dim arr(1 To 5000, 1 To 11)
Dim mypath$, myname$
Application.DisplayAlerts = False
Application.ScreenUpdating = False
mypath = ThisWorkbook.Path & "/"
myname = Dir(mypath & "*.xl*")
Do While myname <> ""
If myname <> ThisWorkbook.Name Then
Set wb = GetObject(mypath & myname)
With wb
With .Worksheets("成绩学分登记表")
n = n + 1
arr(n, 1) = .[m2]
arr(n, 2) = .[c2]
arr(n, 3) = .[i2]
arr(n, 4) = .[d10]
arr(n, 5) = .[f10]
arr(n, 6) = .[h10]
arr(n, 7) = .[j10]
arr(n, 8) = .[m10]
arr(n, 9) = .[o10]
arr(n, 10) = .[q10]
arr(n, 11) = .[s10]
End With
wb.Close False
End With
End If
myname = Dir()
Loop
With ThisWorkbook.Worksheets("汇总")
.[a4].Resize(UBound(arr), 11) = arr
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "提取完成,请核查!"
End Sub
|
|