|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test0()
Dim ar, br(), strText As String
Dim i As Long, j As Long, k As Long
ar = Range("C6", Range("C6").End(xlDown))
ReDim br(1 To UBound(ar), 1 To 60)
For i = 1 To UBound(ar)
j = 0
strText = Trim(ar(i, 1))
If Right(strText, 1) = "/" Then strText = Left(strText, Len(strText) - 1)
ProcessData br, strText, i, j
If j > k Then k = j
Next
Range("F11").Resize(UBound(br), k * 3) = br
End Sub
Function ProcessData(br(), strText$, posRow&, nCount&)
Dim ar, strTemp As String
Dim i As Long, posCol As Long
i = InStr(strText, "数量") + 2
i = InStr(i, strText, "/")
If i Then strTemp = Left(strText, i) Else strTemp = strText
If Len(strTemp) Then
posCol = nCount * 3
ar = Split(strTemp, ",单价")
br(posRow, posCol + 1) = ar(0)
br(posRow, posCol + 2) = Val(ar(UBound(ar)))
br(posRow, posCol + 3) = Val(Split(ar(UBound(ar)), "数量")(1))
nCount = nCount + 1
strText = Replace(strText, strTemp, vbNullString)
If Len(strText) Then ProcessData br, strText, posRow, nCount
End If
End Function |
评分
-
1
查看全部评分
-
|