+ Reply to Thread
Results 1 to 2 of 2

type mismatch error in Benford's law macro

  1. #1
    Sody
    Guest

    type mismatch error in Benford's law macro

    I am trying to run a Benford's law analysis. I get a run time error 13 -
    type mismatch at the following point of the macro:
    For Colcells = 1 To Row
    x = Left(Cells(Colcells,Step), 2)
    If x > 9 Then
    Arraytwotest(x) = Arraytwotest(x) +1
    End If

    There is a series of arrays for each of the 9 digits of a number. going from
    arrayone to arrayzero. Then there is an array named arraytwotest(10 to 99)
    as Integer so that a one digit number does not create an error. This is a
    fraud application that published in the Journal of Accountancy in August 2003
    with an accompanying download. I downloaded the excel worksheet with macros
    and did not make any changes other than import my data file. Any suggestions?

  2. #2
    K Dales
    Guest

    RE: type mismatch error in Benford's law macro

    The Left function returns a string value; you are at least implicitly
    converting your number to string. Make it x = Val(Left(Cells(Colcells,Step),
    2))
    --
    - K Dales


    "Sody" wrote:

    > I am trying to run a Benford's law analysis. I get a run time error 13 -
    > type mismatch at the following point of the macro:
    > For Colcells = 1 To Row
    > x = Left(Cells(Colcells,Step), 2)
    > If x > 9 Then
    > Arraytwotest(x) = Arraytwotest(x) +1
    > End If
    >
    > There is a series of arrays for each of the 9 digits of a number. going from
    > arrayone to arrayzero. Then there is an array named arraytwotest(10 to 99)
    > as Integer so that a one digit number does not create an error. This is a
    > fraud application that published in the Journal of Accountancy in August 2003
    > with an accompanying download. I downloaded the excel worksheet with macros
    > and did not make any changes other than import my data file. Any suggestions?


+ 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