我有连续的数据。让我们A1到XFD1,我想分裂我的 每第6列的数据。这意味着A1-F1原样,从G1-L1应该转移到A2-F2,依此类推。
示例:
A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F
我需要这样:
A B C D E F
A B C D E F
A B C D E F
A B C D E F
答案 0 :(得分:0)
此VBA例程将起作用。
Sub SplitData()
Dim data As Range, arr() As Variant
Dim row As Integer, i As Integer, j As Integer
Set data = Range(Range("A1"), Range("A1").End(xlToRight))
arr = data
data.ClearContents
row = 1
On Error Resume Next
For i = 1 To data.Columns.Count Step 6
For j = 0 To 5
Cells(row, j + 1) = arr(1, i + j)
Next j
row = row + 1
Next i
End Sub