help with Array syntax

Results 1 to 3 of 3

Thread: help with Array syntax

  1. #1
    Join Date
    Dec 1969

    Default help with Array syntax

    I thought I knew Array that well, but I cannot get this to work.<BR>What I want to do is parse the costcenter accdg to starting position and length gathered from 2-d array arrSegments and then store the parsed values in the arrCodes array. I used getRows to get the 2-d array and got the value of the numofsegs variable from another function. Please help.<BR><BR><BR>dim costcenter, arrCodes<BR>...<BR>costcenter = "I23456def987abc"<BR>Call ParseCostCenter<BR><BR>Sub ParseCostCenter<BR>dim count<BR>arrCodes = Array()<BR>for count=0 to numOfSegs -1<BR>&#039;----this statement doesn&#039;t seem to give me what I want -----<BR>arrCodes(count) = Mid(costCenter, arrSegments(2, count), arrSegments(1, count))<BR>next<BR>End Sub

  2. #2
    Join Date
    Dec 1969

    Default RE: help with Array syntax

    I don&#039;t understand what you&#039;re trying to do here: <BR><BR>arrCodes(count) = Mid(costCenter, arrSegments(2, count), arrSegments(1, count))<BR><BR><BR>Mid works like this: <BR><BR>Mid(STRING, START, LENGTH) <BR><BR>For example, <BR><BR>Mid("MY STRING",4,6) will return "STRING"<BR><BR> <BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Array() returns a variant

    and you can&#039;t "empty" it this way.<BR><BR>What you want is something like<BR><BR>Dim arrCodes(50)<BR><BR>and then populate it the way you are.

Posting Permissions

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