Hi everyone,
I use a Macro (code attached) to flatten my dataset for dates (From vertical to Horizontal). Sample file is attached. However, in the resulting file dates appear as text and therefore, does not allow me to upload and use it with other softwares like SPSS for further analysis. Can someone please help me change the Macro code so that in the resultant file I get dates as numerical?
Thank you
Option Explicit
Sub abc()
Const cShName As String = "sheet1"
Dim aArr, e, x, i As Long
With Sheets(cShName)
aArr = .Range("a1").CurrentRegion.Value
End With
Worksheets.Add
With CreateObject("scripting.dictionary")
.comparemode = 1
For i = 1 To UBound(aArr)
If Not .exists(aArr(i, 1)) Then
.Item(aArr(i, 1)) = Join(Array(aArr(i, 1), aArr(i, 2), aArr(i, 3), aArr(i, 4), aArr(i, 5)), "|")
Else
.Item(aArr(i, 1)) = Join(Array(.Item(aArr(i, 1)), aArr(i, 5)), "|")
End If
Next
i = 1
For Each e In .keys
x = Split(.Item(e), "|")
Cells(i, "a").Resize(, UBound(x) + 1) = x
i = i + 1
Next
End With
End Sub
Bookmarks