LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Array Logic Test

For whatever reason, I'm stuck on this problem.

I know how to loop through an Array and then 'do things' if my test item is in the array:

Dim Arr(1 to 4) as String, Element as Variant
'code assigning values to Arr(1 to 4) here

For Each Element in Arr
If InStr(StartString, Element) 0 Then Call 'subroutine here
Next


What I'm trying to do is to do things if Element is Not in StartString. I've thought about putting a nested Boolean in the loop, default it to False, loop through the entire array and swap it to True if there's a hit, then test the Boolean to determine to take the next action or not:


Dim Tester as Boolean, Element as Variant, Arr(1 to 4) as String
'code assigning values to Arr(1 to 4) here

Tester = False
For Each Element in Arr
If InStr(StartString, Element) 0 Then Tester = True
Next

If Tester = True Then Call 'subroutine here


Is there a more effective/efficient way to accomplish this? Am I trying to overcomplicate it and this is the best route to take?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logic Test ? Zeno Excel Worksheet Functions 4 July 11th 06 01:18 PM
MORE THAN ONE LOGIC TEST jan kay Excel Worksheet Functions 3 February 5th 06 01:41 AM
Need help on Logic test!!! jbf frylock Excel Discussion (Misc queries) 5 January 9th 06 09:43 PM
logic test toolman New Users to Excel 1 October 8th 05 05:19 AM
Logic test Ajit Excel Programming 1 October 13th 04 09:11 PM


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"