The following VBA will transpose your data if you first
1. Delete column A
2. Move Time and Age cells down one row.
3. Delete row1 so that all information starts in cell A1
Option Explicit
Sub Normalize()
Dim s1 As Worksheet, s2 As Worksheet
Dim i As Long, lr As Long, lrt As Long
Dim lc As Long
Set s1 = Sheets("Data")
Set s2 = Sheets("Result")
lr = s1.Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = 2 To lr
lc = s1.Cells(i, Columns.Count).End(xlToLeft).Column
lrt = s2.Range("D" & Rows.Count).End(xlUp).Row + 1
s2.Range("A1") = "Date"
s2.Range("B1") = "Time"
s2.Range("C1") = "Age"
s2.Range("D1") = "Data"
s1.Range(Cells(1, 3), Cells(1, lc)).Copy
s2.Range("A" & lrt).PasteSpecial xlPasteValues, , , True
s1.Range("A" & i).Copy s2.Range("B" & lrt)
s1.Range("B" & i).Copy s2.Range("C" & lrt)
s1.Range(Cells(i, 3), Cells(i, lc)).Copy
s2.Range("D" & lrt).PasteSpecial xlPasteValues, , , True
Application.CutCopyMode = False
Next i
lrt = s2.Range("A" & Rows.Count).End(xlUp).Row
For i = 3 To lrt
If s2.Range("B" & i) = "" Then
s2.Range("B" & i) = s2.Range("B" & i - 1)
End If
If s2.Range("C" & i) = "" Then
s2.Range("C" & i) = s2.Range("C" & i - 1)
End If
Next i
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "complete"
End Sub
Bookmarks