|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码改一下。
- Sub ykcbf() '//2024.9.19
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("Scripting.Dictionary")
- hgz = Application.InputBox("请输入合格证编号:", "合格证编号", 2024206)
- fn = [{"COC","登记"}]
- With Sheets("COC")
- s = .[l2].Value
- d(s) = Array(.[d22].Value, .[d7].Value, .[c7].Value, "2023-1", .[j7].Value, .[f7].Value, .[l5].Value, .[m5].Value, .[k7].Value)
- End With
- With Sheets("登记")
- .Cells(2, "i").Value = hgz
- s = hgz
- If d.exists(s) Then
- .Cells(2, 2) = d(s)(0)
- .Cells(2, 3) = d(s)(1)
- .Cells(2, 4) = d(s)(2)
- .Cells(2, 5) = d(s)(3)
- .Cells(2, 6) = d(s)(4)
- .Cells(2, 7) = d(s)(5)
- .Cells(2, "o") = d(s)(6)
- .Cells(2, "p") = d(s)(7)
- .Cells(2, "t") = d(s)(8)
- End If
- End With
- Worksheets(fn).Copy
- Set wb = ActiveWorkbook
- wb.Sheets("登记").DrawingObjects.Delete
- wb.SaveAs Filename:=ThisWorkbook.Path & "" & s & "-123.xlsx", FileFormat:=51
- wb.Close
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|