|
楼主 |
发表于 2022-12-10 09:04
|
显示全部楼层
入库数量p列代出来的应该是入库数G列,现在代出来的是F编码列,咋改下代码- Sub tiqu()
- Dim arr, brr, i&, j&, z&, v&, k&
- Dim t
- Dim d As Object
- t = Timer
- Application.ScreenUpdating = False '关闭屏幕刷新(可以提高运行速度)
- On Error Resume Next
- Set d = CreateObject("scripting.dictionary")
- With Sheets("基础信息")
- i = .[f65536].End(3).Row
- brr = .Range("f3:l" & i)
- For v = 2 To UBound(brr)
- d(brr(v, 1)) = brr
- Next
- End With
- With Sheet1
- z = .[f65536].End(3).Row
- arr = .Range("f3:t" & z)
- For j = 2 To UBound(arr)
- If d.exists(arr(j, 1)) Then
- arr(j, 15) = brr(j, 2)
- arr(j, 12) = brr(j, 6)
- arr(j, 11) = arr(j, 1)
- For q = 8 To 10
- arr(j, q) = brr(j, q - 5)
- Next
- End If
- Next
- End With
- [f3].Resize(UBound(arr), UBound(arr, 2)) = arr
- With Sheet1
- For k = z To 4 Step -1
- .Range("c" & k).Value = "20" & VBA.Left(.Range("h" & k), 2)
- .Range("d" & k).Value = VBA.Mid(.Range("h" & k), 3, 2)
- .Range("e" & k).Value = "'" & VBA.Mid(.Range("h" & k), 5, 2)
- .Range("r" & k).Value = Val(.Range("q" & k).Value) * Val(.Range("p" & k).Value)
- .Range("s" & k).Value = Val(.Range("r" & k).Value) * 1.3
- Next
- End With
- With [a3].CurrentRegion.Resize(, 20)
- .HorizontalAlignment = xlCenter '文字居中
- .Borders.LineStyle = xlContinuous '边框默认
- .EntireRow.AutoFit '自动行宽
- .EntireColumn.AutoFit '自动列宽
- '.Font.ColorIndex = 3 '设置字体颜色
- .Font.Size = 12 '设置字体大小
- .Font.Name = "微软雅黑" '设置字体名称
- End With
- Application.ScreenUpdating = True '开启屏幕刷新
- MsgBox "提取完毕,用时" & Format(Timer - t, "0.00s"), 64, "看到了吗?"
- End Sub
复制代码
|
|