|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub yy()
- Dim ar, br(), cutstr As String
- ar = Range("b5:h" & [d65536].End(3).Row)
- ReDim br(1 To 10000, 1 To 7)
- x = 1
- For i = 1 To UBound(ar)
- If InStr(ar(i, 3), "/") > 1 Then
- k = Len(ar(i, 3)) - Len(Replace(ar(i, 3), "/", ""))
- For j = 1 To k + 1
- br(x, 1) = ar(i, 1)
- br(x, 2) = ar(i, 2)
- If j = 1 Then
- br(x, 3) = Left(ar(i, 3), InStr(ar(i, 3), "/") - 1)
- cutstr = br(x, 3) & "/"
- Else
- If j = k + 1 Then
- br(x, 3) = Right(ar(i, 3), Len(ar(i, 3)) - Len(cutstr))
- Else
- br(x, 3) = Left(Right(ar(i, 3), Len(ar(i, 3)) - Len(cutstr)), InStr(Right(ar(i, 3), Len(ar(i, 3)) - Len(cutstr)), "/") - 1)
- End If
- cutstr = cutstr & br(x, 3) & "/"
- End If
- br(x, 4) = ar(i, 4) / (k + 1)
- br(x, 5) = ar(i, 5)
- br(x, 6) = ar(i, 6)
- br(x, 7) = ar(i, 7) / (k + 1)
- x = x + 1
- Next
- cutstr = ""
- Else
- For j = 1 To 7
- br(x, j) = ar(i, j)
- Next
- x = x + 1
- End If
- Next
- [k5].Resize(x, 7) = br
- End Sub
复制代码 |
|