|
Sub test()
On Error Resume Next
Dim arr
arr = Sheets("客户需求").Range("a1").CurrentRegion
brr = Sheets("正向BOM").Range("a1").CurrentRegion
crr = WorksheetFunction.Transpose(Sheets("正向BOM").Range("a1", Sheets("正向BOM").Cells(Rows.Count, 1).End(xlUp)))
Sheets("BOM拆解计划").Activate
Columns("a:b").NumberFormatLocal = "@"
For j = 4 To UBound(arr)
h = WorksheetFunction.Match(CStr(arr(j, 1)), crr, 0)
hg = Range("a" & Rows.Count).End(xlUp).Row + 1
i = 0
Do
Range("a" & hg + i) = brr(h + i, 1)
Range("b" & hg + i) = brr(h + i, 2)
i = i + 1
Loop Until brr(h + i, 15) = 0
Next j
End Sub
|
|