|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
VBA
- Sub rowsplit()
- Dim r As Range, t() As String
- Dim result() As String
- Dim n As Long, i As Long, j As Long
- Application.ScreenUpdating = False
- Set r = Range("A1").CurrentRegion
- Range("E:E").ClearContents
- n = 0
- For Each c In r
- t = Split(Trim(c), ",")
- For i = 0 To UBound(t)
- If t(i) <> "" Then
- n = n + 1
- ReDim Preserve result(1 To n)
- result(n) = t(i)
- End If
- Next i
- Next c
- If n > 0 Then
- Range("E1").Resize(n).Value = WorksheetFunction.Transpose(result)
- End If
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|