|
Option Explicit
Sub TEST6()
Dim ar, br, i&, j&, r&, dic As Object, iPosRow&
Dim strPath$, strFileName$, wks As Worksheet
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
strPath = ThisWorkbook.Path & "\"
With [A1].CurrentRegion
.Offset(5).Clear 'Contents
ar = .Resize(10 ^ 3).Value
r = 5
End With
strFileName = strPath & "教师基本信息.xls"
If Dir(strFileName) <> "" Then
With GetObject(strFileName)
For Each wks In .Worksheets
br = wks.[A1].CurrentRegion.Value
For i = 3 To UBound(br)
If Len(br(i, 2)) Then
r = r + 1
For j = 2 To UBound(br, 2)
ar(r, j) = br(i, j)
Next j
dic(br(i, 2)) = r
ar(r, 1) = r - 5
End If
Next i
Next
.Close False
End With
End If
strFileName = strPath & "教师教育信息.xls"
If Dir(strFileName) <> "" Then
With GetObject(strFileName)
For Each wks In .Worksheets
br = wks.[A1].CurrentRegion.Value
For i = 4 To UBound(br)
If Len(br(i, 2)) Then
If Not dic.exists(br(i, 2)) Then
r = r + 1
ar(r, 1) = r - 5
ar(r, 2) = br(i, 2)
dic(br(i, 2)) = r
End If
iPosRow = dic(br(i, 2))
For j = 3 To UBound(br, 2)
ar(iPosRow, j + 10) = br(i, j)
Next j
End If
Next i
Next
.Close False
End With
End If
strFileName = strPath & "教师职称信息.xls"
If Dir(strFileName) <> "" Then
With GetObject(strFileName)
For Each wks In .Worksheets
br = wks.[A1].CurrentRegion.Value
For i = 5 To UBound(br)
If Len(br(i, 2)) Then
If Not dic.exists(br(i, 2)) Then
r = r + 1
ar(r, 1) = r - 5
ar(r, 2) = br(i, 2)
dic(br(i, 2)) = r
End If
iPosRow = dic(br(i, 2))
For j = 5 To UBound(br, 2)
ar(iPosRow, j + 16) = br(i, j)
Next j
End If
Next i
Next
.Close False
End With
End If
[A1].Resize(r, UBound(ar, 2)) = ar
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
2
查看全部评分
-
|