View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
RonaldoOneNil RonaldoOneNil is offline
external usenet poster
 
Posts: 117
Default Runtime Error 6 - Overflow

k is your loop counter and changes through each iteration so how can it equal
23468 ?

Anyway, your problem is that k & j as integers can only hold a maximum
number of 32768

You need to declare them as long.

"Phuelgod" wrote:

Hello folks,

I've got a runtime error 6 on the following line of code:

For k = 2 To j

local values a
k = 23468
j = 32933

both are declared integers

In a nutshell, the code find out how many rows of data there are, then goes
through each row to count the data by type (Select Case Left(Cells(k,2),2)).

Is there a limit to iterations on a for...next loop?

Any help troubleshooting this will be appreciated

Thanks!

Frank