Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Error type mismatch in writing macro ub Excel Worksheet Functions 2 September 26th 07 12:48 PM
Macro error type mismatch Jurassien Excel Discussion (Misc queries) 3 February 23rd 07 08:14 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Visual Basic macro run time error(13) type mismatch Paul Excel Discussion (Misc queries) 0 October 25th 05 07:28 AM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"