每15列移动一个新行

我有一个Excel工作表,但所有的数据来自第1行。我需要将每第16列移动到下一行。 所以我的数据应该在列1到列15中。我不是很精通Excel,所以请耐心等待。

Sub dividde_16() No_of_columns = Cells(1, Columns.Count).End(xlToLeft).Column No_of_rows = Int(No_of_columns / 15) + 1 For i = 1 To No_of_rows For j = 1 To 15 Cells(i + 1, j) = Cells(i * 15 + j) Next Next Range(Cells(1, 16), Cells(1, No_of_columns)) = "" End Sub 

你也许可以尝试这样的事情:

 Sub Move_to_Columns() Dim lR As Long, R As Range lR = Range("A" & Rows.Count).End(xlUp).Row Set R = Range("A1", "A" & lR) Application.ScreenUpdating = False Application.Calculation = xlCalculationManual For Each C In R If C.Row Mod 16 = 0 Then C.Offset(-1, 1).Value = C.Value C.ClearContents End If Next C Application.Calculation = xlCalculationAutomatic End Sub 

但用列而不是行。