+ Reply to Thread
Results 1 to 2 of 2

Running a macro on a file, but Mac's can't

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    16

    Running a macro on a file, but Mac's can't

    A guru here helped me with a macro, but I believe that they might now be on vacation... I'm on a Mac can can't run the script below on the excel file attached... client is yelling at me - hoping someone can run this macro on the file and post it back to me?

    The only thing the macro doesn't do automatically is out the combined info in column B in numerical order, i.e.:

    COLUMN A............ COLUMN B
    A50000..........................4
    A50000..........................4
    A50000..........................14
    A50000..........................92

    Becomes:
    COLUMN A............ COLUMN B
    A50000..........................4, 14, 92

    (what happens with the macro as is:
    A50000..........................92, 15, 4)

    Hoping someone can help me out. This project has killed me.



    Sub x()

    Dim sData() As String, vInput(), i As Long, n As Long

    With Range("A1", Range("B" & Rows.Count).End(xlUp))
    vInput = .Value
    .ClearContents
    End With

    ReDim sData(1 To UBound(vInput, 1), 1 To 2)

    With CreateObject("Scripting.Dictionary")
    For i = 1 To UBound(vInput, 1)
    If Not .Exists(vInput(i, 1)) Then
    n = n + 1
    sData(n, 1) = vInput(i, 1)
    sData(n, 2) = vInput(i, 2)
    .Add vInput(i, 1), n
    ElseIf .Exists(vInput(i, 1)) Then
    If InStr(sData(.Item(vInput(i, 1)), 2), vInput(i, 2)) = 0 Then
    sData(.Item(vInput(i, 1)), 2) = sData(.Item(vInput(i, 1)), 2) & ", " & vInput(i, 2)
    End If
    End If
    Next i
    End With

    Range("A1").Resize(n, 2) = sData

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Running a macro on a file, but Mac's can't

    Some versions of Mac Office do not support VBA
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

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