|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub lkyy()
strfile = Application.GetOpenFilename("EXCEL文档(*.xl*),", , "请选择记录文件")
If strfile = "" Then Exit Sub
With Workbooks.Open(strfile)
ar = .Sheets(1).UsedRange
L元件品号 = .Sheets(1).Rows(1).Find("编号", , , xlWhole).Column
L位置 = .Sheets(1).Rows(1).Find("位号", , , xlWhole).Column
.Close 0
End With
ReDim br(1 To 1000, 1 To 2)
For i = 2 To UBound(ar)
If Len(ar(i, L位置)) Then
If Right(ar(i, L位置), 1) = "," Then x = Left(ar(i, L位置), Len(ar(i, L位置)) - 1) Else x = ar(i, L位置)
For j = 0 To UBound(Split(x, ","))
n = n + 1
br(n, 1) = ar(i, L元件品号)
br(n, 2) = Split(ar(i, L位置), ",")(j)
Next
End If
Next
Cells.ClearContents
Range("a1").Resize(n, 2) = br
End Sub
|
评分
-
1
查看全部评分
-
|