Limebites,
I assume that you dates are in column I beginning in cell I1.
The macro uses four arrays in memory.
Detach/open workbook ReorgData oiarray to aarray barray carray - Limebites - EF977786 - SDG15.xlsm and run the ReorgData macro.
If you want to use the macro on another workbook:
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
Option Explicit
Sub ReorgData()
' stanleydgromjr, 12/28/2013
' http://www.excelforum.com/excel-new-users-basics/977786-copy-a-column-and-paste-in-specific-cells.html
Dim oi As Variant, a As Variant, b As Variant, c As Variant
Dim i As Long, ii As Long, lr As Long, n As Long, sn As Long, nn As Long
Columns("A:C").ClearContents
lr = Cells(Rows.Count, "I").End(xlUp).Row
n = Application.Ceiling(lr, 3)
oi = Range("I1:I" & n)
ReDim a(1 To (n / 3) * 3, 1 To 1)
ReDim b(1 To (n / 3) * 3, 1 To 1)
ReDim c(1 To (n / 3) * 3, 1 To 1)
ii = 1
sn = 1
nn = (n / 3)
For i = sn To nn Step 1
a(ii, 1) = oi(i, 1)
ii = ii + 3
Next i
Cells(2, 1).Resize(UBound(a, 1), UBound(a, 2)) = a
ii = 1
sn = nn + 1
nn = sn + (n / 3)
On Error Resume Next
For i = sn To nn Step 1
b(ii, 1) = oi(i, 1)
ii = ii + 3
Next i
On Error GoTo 0
Cells(2, 2).Resize(UBound(b, 1), UBound(b, 2)) = b
ii = 1
sn = nn + 1
nn = sn + (n / 3)
On Error Resume Next
For i = sn To nn Step 1
c(ii, 1) = oi(i, 1)
ii = ii + 3
Next i
On Error GoTo 0
Cells(2, 3).Resize(UBound(c, 1), UBound(c, 2)) = c
Columns("A:C").AutoFit
End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm
Then run the ReorgData macro.
Bookmarks