答:使用程式設計來完成。確保上圖工作表為活動工作表,按ALT+F11組合鍵,開啟VB視窗。執行“插入”-“模組”,複製下面程式碼進去,按F5執行。
Sub Demo()
Dim Cell As Range
Dim DesRng As Range
Dim i As Long
Dim Arr As Variant
Set Cell = Range("A3")
Set DesRng = Range("D3")
Do Until IsEmpty(Cell)
Arr = Split(Cell.Offset(0, 1), ",")
For i = LBound(Arr) To UBound(Arr)
With DesRng
.Value = Cell
.Offset(0, 1) = Arr(i)
End With
Set DesRng = DesRng.Offset(1, 0)
Next
Set Cell = Cell.Offset(1, 0)
Loop
End Sub
執行截圖截圖:
答:使用程式設計來完成。確保上圖工作表為活動工作表,按ALT+F11組合鍵,開啟VB視窗。執行“插入”-“模組”,複製下面程式碼進去,按F5執行。
Sub Demo()
Dim Cell As Range
Dim DesRng As Range
Dim i As Long
Dim Arr As Variant
Set Cell = Range("A3")
Set DesRng = Range("D3")
Do Until IsEmpty(Cell)
Arr = Split(Cell.Offset(0, 1), ",")
For i = LBound(Arr) To UBound(Arr)
With DesRng
.Value = Cell
.Offset(0, 1) = Arr(i)
End With
Set DesRng = DesRng.Offset(1, 0)
Next
Set Cell = Cell.Offset(1, 0)
Loop
End Sub
執行截圖截圖: