答案 0 :(得分:0)
您需要一个遍历每一行的宏,然后遍历第一列中的每个值。此基本示例宏要求您选择表中的一个单元格,然后创建一个拆分数据的新工作表。
Public Sub Expand()
Dim ra As Range
Dim str As Variant
Dim ws As Worksheet
Dim i As Integer
Dim j As Integer
Set ra = Selection.CurrentRegion
Set ws = Worksheets.Add
j = 1
For i = 1 To ra.Rows.Count
For Each str In Split(ra(i, 1), ",")
ws.Cells(j, 1) = str
ws.Cells(j, 2) = ra(i, 2)
j = j + 1
Next str
Next i
End Sub