Option Explicit
Dim recs() As Variant
Dim rng As Range, cell As Range, nAddress As String, x As Integer, y As Integer, i As Integer
Dim n As Integer
Dim chkN As String, curN As String, rDate As Date, rDet As String
Sub getData()
Set rng = Me.Range(Cells(2, 2), Cells(Me.UsedRange.Rows.Count, 2))
curN = rng.Cells(1, 1).Value: x = 1: y = 0
For Each cell In rng
If nAddress = "" Then nAddress = cell.Address
If cell.Value = curN Then
Me.moveData cell, x, y
y = y + 1
Else
Me.trPose
Erase recs
curN = cell.Value
nAddress = cell.Address
y = 0
Me.moveData cell, x, y
y = y + 1
End If
Next cell
End Sub
Sub moveData(cell, x, y)
ReDim Preserve recs(x, y)
rDate = cell.Offset(0, 3).Value: rDet = cell.Offset(0, 4).Value
Select Case x
Case Is = 1
x = 0
Case Is = 0
x = 1
End Select
recs(x, y) = rDate
Select Case x
Case Is = 1
x = 0
Case Is = 0
x = 1
End Select
recs(x, y) = rDet
End Sub
Sub trPose()
For i = 0 To UBound(recs, 2)
Me.Range(nAddress).Offset(0, i + 5).Value = recs(0, i)
n = i + 5
Next i
n = n + 1
For i = 0 To UBound(recs, 2)
Me.Range(nAddress).Offset(0, n).Value = recs(1, i)
n = n + 1
Next i
End Sub