Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Arrays

 
Logged in as: Guest
arrSession:exec spGetSession 2,7,33505
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Arrays
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Arrays - 4/14/2006 8:17:07 AM   
  mcds99


Posts: 424
Score: 4
Joined: 2/28/2006
Status: offline
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]
 
 
Post #: 1
 
 RE: Arrays - 4/17/2006 1:52:13 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
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

(in reply to mcds99)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Arrays Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts