Subscript out of range..

Results 1 to 3 of 3

Thread: Subscript out of range..

  1. #1
    Join Date
    Dec 1969

    Default Subscript out of range..

    The following coding results in a subscript &#039;l&#039; out of range error.<BR><BR>noe = number of employees, already inputted.<BR>sales = sales per employee, already inputted.<BR><BR>it says subscript &#039;i&#039; is out of range, which is on the CLng line.<BR><BR><BR><BR><BR>&#060;% for i = 1 to noe <BR> totsales = totsales + CLng(sales(i))<BR> next <BR><BR>cutpoint=totsales/3<BR>dim Tsales(3)<BR>dim PeopleIn(3)<BR>currtier=1<BR>i=1<BR>do while currtier &#060;= 3<BR> do while Tsales(currtier) &#060; cutpoint <BR> Tsales(currtier)=Tsales(currtier) + CLng(sales(i))<BR> PeopleIn(currtier)=PeopleIn(currtier)+1<BR> i=i+1<BR> loop<BR> currtier=currtier+1<BR>loop<BR>%&#062;<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default maybe sales(i) has only 3 elements

    and since an array starts from 0 your currtier should start from 0 and go to 2<BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Or maybe it has 3 but...

    ...but the value of the variable noe is 13783 ???<BR><BR>How can we guess?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts