选中部分数据区域(多行一列),例如:
转换后:
vba代码:
Sub oneToMany()
Dim TheRng, TempArr
Dim i As Integer, j As Integer, colCount As Integer
Set Dict = CreateObject("Scripting.Dictionary")
Set Dict2 = CreateObject("Scripting.Dictionary")
On Error GoTo line1
If Selection.Cells.Count = 1 Then
Sheets("Sheet2").Range("a1") = Selection
Else
TheRng = Selection
If UBound(TheRng, 1) Mod 3 = 0 Then
colCount = UBound(TheRng, 1) / 3
Else
colCount = (UBound(TheRng,