|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Public Sub 打散()
Dim x As Integer, y As Integer, arr1, arr2, c1 As Integer, c2 As Integer, gao As Integer
Dim xh1 As Integer, xh2 As Integer
gao = Sheets(2).[E65536].End(3).Row + 1
Sheets(2).Range("E13:G" & gao).ClearContents
Sheets(2).Cells(13, "E") = "料号"
Sheets(2).Cells(13, "F") = "规格"
Sheets(2).Cells(13, "G") = "位置"
gao = Sheets(2).[E65536].End(3).Row + 1
x = [A65536].End(3).Row
For y = 2 To x
arr1 = Split(Cells(y, 1), "/")
arr2 = Split(Cells(y, 3), ",")
c1 = Application.CountA(arr1)
c2 = Application.CountA(arr2)
For xh1 = 1 To c1
For xh2 = 1 To c2
Sheets(2).Cells(gao, "E") = Application.Index(arr1, , xh1)
Sheets(2).Cells(gao, "F") = Cells(y, 2)
Sheets(2).Cells(gao, "G") = Application.Index(arr2, , xh2)
gao = gao + 1
Next xh2
Next xh1
Next
MsgBox "BOM转换完成,打散完成"
End Sub
你把代码复制进去,看对不对,我的QQ是418971491,平时很少上,因为上班没网络。 |
|