Below is some code that splits a long column in excel into smaller columns.
This works by clicking into the module, pressing F5 and entering ranges, an output starting point and a cell range to signal the number of entries in each column.
Is there anyway I can automate this, for example, if I have a column with 1:30 starting in A1, I always want to use this range, the output cell I would like is H25 and I would like the number of entries based on whatever I input into say cell G6.
Sub SplitColumn()
'Updateby20141106
Dim rng As Range
Dim InputRng As Range
Dim OutRng As Range
Dim xRow As Integer
Dim xCol As Integer
Dim xArr As Variant
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type: = 8)
xRow = Application.InputBox("Rows :", xTitleId)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type: = 8)
Set InputRng = InputRng.Columns(1)
xCol = InputRng.Cells.Count / xRow
ReDim xArr(1 To xRow, 1 To xCol + 1)
For i = 0 To InputRng.Cells.Count - 1
xValue = InputRng.Cells(i + 1)
iRow = i Mod xRow
iCol = VBA.Int(i / xRow)
xArr(iRow + 1, iCol + 1) = xValue
Next
OutRng.Resize(UBound(xArr, 1), UBound(xArr, 2)).Value = xArr
End Sub