|
更新一下,个人信息更新为最新信息。- Sub ykcbf() '//2024.8.19
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- b = [{"b2","d2","f2","h2","j2","b3","e3","j3","b4","f4"}]
- ReDim brr(1 To 10000, 1 To 10)
- For Each fd In fso.GetFolder(p).SubFolders
- For Each f In fd.Files
- fn = fso.GetBaseName(f)
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("Sheet1")
- arr = .UsedRange
- s = .Range(b(1)).Value
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- For j = 1 To UBound(b)
- brr(m, j) = .Range(b(j)).Value
- Next
- Else
- r = d(s)
- For j = 2 To UBound(b)
- brr(r, j) = .Range(b(j)).Value
- Next
- End If
- For j = 3 To UBound(arr, 2) Step 2
- For i = 10 To 21
- s = .Range(b(1)).Value & "|" & arr(9, j) & "|" & arr(i, 2)
- d(s) = d(s) + arr(i, j)
- Next
- Next
- End With
- wb.Close 0
- Next
- Next
- With sh
- .UsedRange.Offset(4).ClearContents
- .[a5].Resize(m, 10) = brr
- arr = .UsedRange
- For j = 11 To 58
- If arr(3, j) <> Empty Then st = arr(3, j)
- For i = 5 To UBound(arr)
- s = arr(i, 1) & "|" & st & "|" & arr(4, j)
- If d.exists(s) Then
- arr(i, j) = d(s)
- End If
- Next
- Next
- .UsedRange = arr
- ActiveWindow.DisplayZeros = False
- End With
- Set d = Nothing
- Application.ScreenUpdating = False
- MsgBox "OK!"
- End Sub
复制代码
|
|