有没有一种方法可以根据单元格值中的多个条目来生成 excel 中的一般重复行
Is there a way to general duplicate rows in excel based on multiple entries in a cell value
这是我当前的格式
我想要一个公式,输出是这样的
数据在 A 和 B 列中,试试这个简短的宏:
Sub SplitList()
Dim i As Long, j As Long, N As Long
Dim v As String, arr, a
N = Cells(Rows.Count, "A").End(xlUp).Row
j = 1
For i = 1 To N
v = Cells(i, 1).Value
arr = Split(Cells(i, 2).Value, ",")
For Each a In arr
Cells(j, 3).Value = v
Cells(j, 4).Value = a
j = j + 1
Next a
Next i
End Sub
输出在 C 和 D.
列中
这是我当前的格式
我想要一个公式,输出是这样的
数据在 A 和 B 列中,试试这个简短的宏:
Sub SplitList()
Dim i As Long, j As Long, N As Long
Dim v As String, arr, a
N = Cells(Rows.Count, "A").End(xlUp).Row
j = 1
For i = 1 To N
v = Cells(i, 1).Value
arr = Split(Cells(i, 2).Value, ",")
For Each a In arr
Cells(j, 3).Value = v
Cells(j, 4).Value = a
j = j + 1
Next a
Next i
End Sub
输出在 C 和 D.
列中