|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与- Private Sub CommandButton1_Click()
- Dim arr, brr, m%, i%, j%, sh, r%, c%, k
- Set dic = CreateObject("scripting.dictionary")
- With Sheet3
- m = .Range("a1").End(4).Row
- Set sh = .Range("a1:h" & m)
- sh.Sort key1:="出货料号", order1:=1, Header:=xlYes
- arr = .Range("A1").CurrentRegion
- ReDim brr(1 To 10000, 1 To 20)
- For i = 2 To UBound(arr)
- For j = 1 To 8
- If j <> 2 And j <> 6 And j <> 7 Then
- dic(j & "|" & arr(i, 2) & "|" & arr(1, j)) = dic(j & "|" & arr(i, 2) & "|" & arr(1, j)) & "|" & arr(i, j)
- End If
- Next j
- Next i
- r = 1
- For Each k In dic.keys
- t = Split(dic(k), "|")
- brr(r, 1) = Split(k, "|")(1)
- brr(r, 2) = Split(k, "|")(2)
- For i = 1 To UBound(t)
- brr(r, i + 2) = t(i)
- Next i
- r = r + 1
- Next k
- With Sheet1
- .Range("a2").Resize(UBound(brr), UBound(brr, 2)) = brr
- Application.DisplayAlerts = False
- m = .[a2].End(4).Row
- .Range("a1:q" & m).Borders.LineStyle = 1
- .Range("a1:q" & m).Columns.AutoFit
- .[a1] = "来自于客户的初始信息": .[a1:b1].Merge
- .[c1] = "工站生产计划": .[c1:q1].Merge
- For i = 2 To m Step 5
- Sheet1.Range("a" & i).Resize(5, 1).Merge
- Next i
- Application.DisplayAlerts = True
- End With
- End With
- Set dic = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|