Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with WHILE loops

Status
Not open for further replies.

mappryan

Structural
Mar 11, 2011
8
I am very inexperienced with while loops. I am trying to write a loop that checks all the answers in a vector and if they are "OK" then it outputs "OK". I keep getting an "array index invalid for this array problem". I have written a simplified example of this problem to post here. If someone could please take a look and explain what I am doing wrong it would be greatly appreciated. I believe it is due to my lack of knowledge/experience with using a while loop altogether. Thank you
 
Replies continue below

Recommended for you

I don't see where you assign any value to "vec". If I make start and end different from each other the error goes away and veclocation has a value in the output (the value is the next cell after the end of the while).

David
 
well vec is not defined because I am using it as a function and therefore it isnt required to be defined. The origin has something to do with this problem as if i set the origin to zero in worksheet preferences both work. I think I have some sort of misunderstanding of the array indexing that I was hoping someone could clarify
 
IRstuff thank you. I realize what is wrong now. To fix it I am guessing there needs to be an otherwise statement added to the IF statement but I can't seem to get that to work. Any ideas of what i can do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor