|
- Sub lqxs()
- Dim myPath$, myName$, Arr1(), r%, sh As Worksheet, Arr, col%
- Dim i&, Brr, nm$, d, x$, y$, j&, ks, js, yf
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Sheet3.Activate
- yf = 5: col = yf + 12
- Cells(4, col).Resize(500, 1).ClearContents
- Arr = [a1].CurrentRegion
- For i = 4 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- End If
- Next
- For i = 1 To r
- If i <> r Then
- js = Arr1(i + 1) - 1
- Else
- js = UBound(Arr)
- End If
- ks = Arr1(i): x = Arr(ks, 1)
- For j = ks To js
- y = Arr(j, 3)
- If d.exists(x) = False Then Set d(x) = CreateObject("Scripting.Dictionary")
- d(x)(y) = j
- Next
- Next
- myPath = ThisWorkbook.Path & ""
- myName = "表1(完成情况).xls"
- With GetObject(myPath & myName)
- For Each sh In .Sheets
- Brr = sh.Range("A1").CurrentRegion
- x = sh.Name
- If UBound(Brr) > 2 Then
- For j = 3 To UBound(Brr)
- If Brr(j, 1) <> "" Then
- If Val(Split(Brr(j, 1), ".")(0)) = yf Then
- y = Brr(j, 2)
- If d.exists(x) Then
- If d(x).exists(y) Then
- Cells(d(x)(y), col) = Cells(d(x)(y), col) & Brr(j, 3) & " "
- End If
- End If
- End If
- End If
- Next
- End If
- Next
- .Close False
- End With
- Arr = [a1].CurrentRegion
- For i = 4 To UBound(Arr)
- If Arr(i, col) <> "" Then Cells(i, col) = Arr(i, col) & " 共计" & Arr(i, 6) & Arr(i, 4)
- Next
- Application.ScreenUpdating = True
- MsgBox "OK"
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|