|
设个参数表
- Sub ykcbf() '//2024.9.3
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- arr = Sheets("参数表").UsedRange
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- d1(s) = arr(i, 2)
- Next
- Dim zrr(1 To 1000)
- With Sheets("尾单")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 23)
- For i = 6 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then d(s) = i
- Next
- k = d.keys: t = d.items
- For x = 0 To d.Count - 1
- r1 = t(x)
- If x = d.Count - 1 Then r2 = r Else r2 = t(x + 1) - 1
- n = r2 - r1 + 1
- .Cells(r1, "q") = d1(k(x))
- st = .Cells(r1, "q")
- .Cells(r1, "q").Resize(n).Value = st
- Next
- MsgBox "OK!"
- End With
- End Sub
复制代码
|
|