|
收集各人员填写的数据如何提速
我用xlookup手动用工作很卡很慢
听说字典快,请各位大神帮忙,我试编写,但没有成功,非常感谢!
Sub xjzj()
Dim zd As Object, aKey, cKey, dKey, eKey As Variant
Dim Data, sjData As Variant, AR As Double
Workbooks.Open "F:\报表\回\张三.xlsx"
Application.Wait Now + TimeValue("00:00:08")
Workbooks.Open "F:\报表\回\李四.xlsx"
Application.Wait Now + TimeValue("00:00:08")
Workbooks.Open "F:\报表\回\王五.xlsx"
Application.Wait Now + TimeValue("00:00:08")
For wjs = 1 To Workbooks.Count
WJM = Workbooks(wjs).Name
If WJM Like "*张三*" Or WJM Like "*李四*" Or WJM Like "*王五*" Then
NWJM = Mid(WJM, 1, Len(WJM) - 5)
Set zd = CreateObject("Scripting.Dictionary")
XH = Workbooks("报表.xlsm").Sheets("Sheet1").Range("A65536").End(xlUp).Row
Data = Workbooks(WJM).Sheets("Sheet1").Range("A1:E" & XH).Value
For AR = 2 To XH
aKey = Data(AR, 1)
cKey = Data(AR, 3)
dKey = Data(AR, 4)
eKey = Data(AR, 5)
zd.Add aKey, chKey
Next
sjData = Workbooks("报表.xlsm").Sheets("Sheet1").Range("A1:E" & XH).Value
For AR = 4 To XH
aKey = sjData(AR, 1)
cKey = sjData(AR, 3)
dKey = sjData(AR, 4)
eKey = sjData(AR, 5)
Name = sjData(AR, 2)
If zd.Exists(aKey) Then
If Name = NWJM Then
cKey = oDic.Item(aKey) '如果序号在字典里有,就让该序号的C列单元格=字典的item值,但是我写不成功,请帮忙。谢谢!
End If
End If
Next
End If
Next
End Sub
报表附上:
报表.zip
(730.54 KB, 下载次数: 12)
|
|