Arrays

Author Message
mcds99

  • Total Posts : 519
  • Scores: 4
  • Reward points : 0
  • Joined: 2/28/2006
  • Status: offline
Arrays Friday, April 14, 2006 9:17 AM (permalink)
0
I'm Stumped.
 
I have an Excel spreadsheet with multiple sheets.
I use an Inputbox to read a specific sheet name and get the values if a specific cell is non-blank.
I then display the values using wscript.echo
This method displays each value in a dialog box of its own.
 
I want to put each value read from the spreadsheet in an array and wscript.echo the array.
 
I have googled ("I will not ask questions without googling first" : Bart Simpson)
I don't know where or how to load the value in to the array and increment the row in the array so the next
value is loaded.
 
I get the "Subscript out of range" message.
 
[psudocode]
Dim myArray(5)
 
Do while readExecl.sheet(intRow , 1)
if cell <> "" then
    X = cell1 & cell2...
   wsciprt.echo X
   myArray() = X
end if
intRow = intRow + 1
Loop
 
wscript.echo myArray(5)
 
[/psudocode]
 
#1
    ebgreen

    • Total Posts : 8219
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Arrays Monday, April 17, 2006 2:52 AM (permalink)
    0
    To load values into an array, you need to access each individual element of the array. To use your psuedo code:

    Do while readExecl.sheet(intRow , 1)
    i = 0
    if cell <> "" then
      Loop through each cell of interest
        wsciprt.echo X
        myArray(i) = X
        i = i+1
      Loop
    end if
    intRow = intRow + 1
    Loop

    wscript.echo myArray(5)

    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9