请问你要将A列分成几列,我写一个VBA给你。
Sub 宏1()
Dim lastrow As Long, i As Long, k As Long
lastrow = Cells(Rows.Count, 1).End(3).Row
i = 1
k = 1
Do While i <= lastrow
Cells(k, 2) = Cells(i, 1)
Cells(k, 3) = Cells(i + 1, 1)
Cells(k, 4) = Cells(i + 2, 1) '分n列则做n次
i = i + 3 '下移n行
k = k + 1
Loop
End Sub
追问数据全在sheet1的A1列,A1,A2,A3是一个人的信息,然后我想变成A1,B1,C1。A4,A5,A6又是另一个人的信息,接着就变成A2,B2,B3。如果不能实现,变成B4,B5,B6也行,到时候我自己去除空行。
追答Sub 宏1()
Dim lastrow As Long, i As Long, k As Long
lastrow = Cells(Rows.Count, 1).End(3).Row
i = 1
k = 2
Do While i <= lastrow
Cells(k, 4) = Cells(i, 1) 'B4
Cells(k, 5) = Cells(i + 1, 1) 'B5
Cells(k, 6) = Cells(i + 2, 1) 'B6
i = i + 3 '下移n行
k = k + 1
Loop
End Sub