JoeMo,
Nice approach - one for my archives.
Tabanag,
Welcome to the MrExcel forum.
I assumed that your displayed raw data was in one worksheet, and, that the results would be in another.
Here is another macro solution for you to consider, based on my above assumption, and, it will adjust the varying number of raw data rows, and, columns.
I assume that both worksheets already exist. You can change the worksheet names in the macro.
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.
Code:
Sub Tabanag()
' hiker95, 05/19/2016, ME942301
Dim w1 As Worksheet, w2 As Worksheet
Dim r As Long, lr As Long, c As Long, lc As Long, nr As Long
Application.ScreenUpdating = False
Set w1 = Sheets("Sheet1") '<-- you can change the sheet name here
Set w2 = Sheets("Sheet2") '<-- you can change the sheet name here
w2.Columns(1).ClearContents
With w1
lr = .Cells.Find("*", , xlValues, xlWhole, xlByRows, xlPrevious, False).Row
lc = .Cells.Find("*", , xlValues, xlWhole, xlByColumns, xlPrevious, False).Column
For r = 1 To lr
If r = 1 Then
nr = 1
Else
nr = w2.Cells(w2.Rows.Count, "A").End(xlUp).Row + 1
End If
w2.Cells(nr, 1).Resize(lc).Value = Application.Transpose(w1.Range(.Cells(r, 1), .Cells(r, lc)).Value)
Next r
End With
With w2
.Columns(1).AutoFit
.Activate
End With
Application.ScreenUpdating = True
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, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
Then run the
Tabanag macro.