Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-27-2013, 10:20 AM
BobBridges's Avatar
BobBridges BobBridges is offline How do you loop through an array with some empty values? Windows 7 64bit How do you loop through an array with some empty values? Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

(Further explanation:) Omaha, Paul included an Exit statement, which is correct if you want to stop once you find "the" value with the slash in it. My version assumes there are multiple values you want to save, and keeps looking through the whole array.

As for the starting point of the array, that depends on how you defined the array. What Paul's saying is that if you define an array like this:
Code:
Dim splitslash(10)
...then VBA will define splitslash with 11 entries running from splitslash(0) to splitslash(10). I'm used to programming in other languages that assume 1 as the bottom entry, so I keep forgetting how VBA does it; to avoid the uncertainty I usually specify both limits, like this:
Code:
Dim splitslash(0 to 10)
...or "1 to 10" or "5 to 23" or whatever suits my purpose.

But no matter what you specified when you defined the array, you can always have your program use the LBound function, which mirrors UBound:
Code:
For i = LBound(splitslash) To UBound(splitslash)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you loop through an array with some empty values? CORREL function with a constant array j2b3 Excel 3 01-30-2013 01:49 AM
How do you loop through an array with some empty values? Convert String Array to Integer Array from a User Input? tinfanide Excel Programming 4 12-26-2012 08:56 PM
Apparently empty (blank) cells aren't empty daymaker Excel 3 03-08-2012 03:41 PM
How to reserve an array in a public function? tinfanide Word VBA 2 02-27-2012 06:51 AM
How do you loop through an array with some empty values? Complex array formula andrei Excel 9 02-03-2012 03:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft