如何通过宏更改数据格式模式? 目前数据类似于
1. Equation contents1 contents 2 contents 3
2. ANBCDESF A C E
3. YUIOLUIO Y O I
我想将数据更改为
1. Equation contents
2. ANBCDESF A
3. ANBCDESF C
4. ANBCDESF E
5. YUIOLUIO Y
6. YUIOLUIO O
7. YUIOLUIO I
答案 0 :(得分:1)
这里有一个可能的变种
Sub test()
Dim Dic As Object: Set Dic = CreateObject("Scripting.Dictionary")
Dim cl As Range, Key As Variant, i&
i = 1
For Each cl In Range("B2:D" & Cells(Rows.Count, "A").End(xlUp).Row)
Dic.Add i & ":" & Cells(cl.Row, 1).Value, cl.Value: i = i + 1
Next cl
i = 2: [F1] = "Equation": [G1] = "contents"
For Each Key In Dic
Cells(i, "F").Value = Split(Key, ":")(1)
Cells(i, "G").Value = Dic(Key)
i = i + 1
Next Key
Set Dic = Nothing
End Sub
输出