|
楼主 |
发表于 2019-12-16 21:52
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub t() Dim i, j, d, dd, jj, wjm Set d = CreateObject("Scripting.Dictionary") Set dd = CreateObject("Scripting.Dictionary") For jj = 11 To 65 Step 3 wjm = Dir(ThisWorkbook.Path & "\*" & Format(Cells(1, jj), "mm-dd") & "*.*") If wjm <> "" Then d.RemoveAll: dd.RemoveAll With GetObject(ThisWorkbook.Path & "\" & wjm) For i = 7 To .Sheets(1).[a65536].End(3).Row d(Val(.Sheets(1).Range("b" & i).Value)) = .Sheets(1).Range("d" & i) dd(Val(.Sheets(1).Range("b" & i).Value)) = Array(.Sheets(1).Range("g" & i).Value, .Sheets(1).Range("l" & i).Value, .Sheets(1).Range("o" & i).Value) Next i .Close False End With For i = 3 To [a65536].End(3).Row If Range("c" & i) = "" Then Range("c" & i) = d(Range("b" & i).Value) Range(Cells(i, jj), Cells(i, jj + 2)) = dd(Range("b" & i).Value) Next i End If Next End Sub |
|