|
Sub CHAXU()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object, dc As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("基础数据表")
r = .Cells(Rows.Count, 2).End(xlUp).Row
If r < 2 Then MsgBox "基础数据表为空!": End
.Range("j2:j" & r) = Empty
ar = .Range("a1:j" & r)
For i = 2 To UBound(ar)
If Trim(ar(i, 2)) <> "" Then
d(Trim(ar(i, 2))) = i
End If
Next i
For Each sh In Sheets
If IsNumeric(sh.Name) Then
rs = sh.Cells(Rows.Count, 2).End(xlUp).Row
br = sh.Range("b1:b" & rs)
For i = 2 To UBound(br)
If Trim(br(i, 1)) <> "" Then
xh = d(Trim(br(i, 1)))
If xh <> "" Then
ar(xh, 10) = sh.Name
End If
End If
Next i
End If
Next sh
.Range("a1:j" & r) = ar
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
评分
-
2
查看全部评分
-
|