Results 1 to 6 of 6

Altering the existing macro to get date as numerical va;ue

Threaded View

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Miami, US
    MS-Off Ver
    Excel 2007
    Posts
    83

    Altering the existing macro to get date as numerical va;ue

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1