Closed Thread
Results 1 to 2 of 2

Need quick debugging help

Hybrid View

newbieexceldude Need quick debugging help 06-07-2009, 04:15 PM
shg Re: Need quick debugging help 06-07-2009, 04:16 PM
  1. #1
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    115

    Need quick debugging help

    Trying to figure out why I'm getting a syntax error. The bolded line seems to be the culprit.


    Sub test()
    Dim a, e, b(), n As Long, x, w(), t As Long, z As String
    Dim myTitle As String, myWord, myCount, myDensity
    With Range("a1", Range("a" & Rows.Count).End(xlUp))
        a = .Value
        ReDim b(1 To UBound(a, 1) * 2, 1 To Columns.Count)
        With Createobject("Scripting.Dictionary")
            .CompareMode = vbTextCompare
            For Each e In a
                If InStr(1, e, "Not", 1) > 0
                    x = Trim(Split(e, "in")(1))
                    myTitle = Trim(Left$(x, InStrRev(e, "(") - 1))
                    myWord = Val(Mid$(e, InStrRev(e, "(") + 1)) 
                    myCount = 0
                    myDensity = 0
                Else
                    x = Split(Split(e, " ", 8)(7), "(")(0)
                    z = Replace(Trim(Left$(x, InStrRev(x, " "))), "words", "",,,1)
                    myTitle = Trim(Left$(x, InStrRev(e, "(") - 1))
                    myWord = Val(Split(e, " in ")(1))
                    myCount = Val(Split(e)(3))
                    myDensity = Val(Replace(Split(e, "Density: ")(1),"%","")) & "%"
                End If
                If Not .exists(z) Then
                    t = t + 3 : b(1, t - 2) = myTitle & " Words"
                    b(1, t - 1) = myTitle & " Count" : b(1, t) = myTitle & " Density"
                    .item(z) = VBA.Array(2, t)
                End If
                w = .item(z)
                b(w(0), w(1) - 2) = myWord : b(w(0), w(1) - 1) = myCount
                b(w(0), w(1)) = myDensity : w(0) = w(0) + 1
                .item(z) = w
                maxRow = Application.Max(maxRow, w(0))
            Next
        End With
        .Offset(, 2).Resize(maxRow, t).Value = b
    End With
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Need quick debugging help

    Please take a few minutes to re-read the forum rules, and then start a new thread with a descriptive title.
    Entia non sunt multiplicanda sine necessitate

Closed 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