I ended up fixing this by using a filter on my array:
'ReDim arrDeviceNames() to trim the "EMPTY DEVICE"
arrNonEmptyDeviceNames = Filter(arrDeviceNames, "EMPTY DEVICE",
False)
Thanks guys,
Matt
On Nov 3, 9:13 am, RemyMaza <[email protected]> wrote:
> I have an array of values that come in off of a form. One of these
> values is "Empty Device". Here's the code I'm using to handle that:
>
> Devices = Array(cmb1.Value, cmb2.Value, cmb3.Value, cmb4.Value,
> cmb5.Value, cmb6.Value, cmb7.Value)
>
> Now that I have my Devices array, I loop through the number of devices
> that were selected and assign values to other variables and another
> array. Here's some of that code:
>
> For i = 0 To UBound(Devices)
> If Not Devices(i) = "" Then NumOfDevices = NumOfDevices + 1
> If Devices(i) = "EMPTY DEVICE" Then NumOfEmptyDevices =
> NumOfEmptyDevices + 1
> 'Match Description to Ganged
> Select Case True
> Case Devices(i) = "EMPTY DEVICE"
> Ganged = Ganged & "X "
> ReDim Preserve arrDeviceName(0 To i)
> arrDeviceName(i) = "EMPTY DEVICE"
>
> Case Devices(i) = "20A RECEPTACLE"
> Ganged = Ganged & "O "
> ReDim Preserve arrDeviceName(0 To i)
> arrDeviceName(i) = "D20120"
>
> Case Devices(i) = "20A GFI"
> Ganged = Ganged & "G "
> ReDim Preserve arrDeviceName(0 To i)
> arrDeviceName(i) = "G20120"
>
> I need to find out a way to handle "EMPTY DEVICES". Later on in the
> code, I loop through the TotalNumOfDevices which equals all of the
> devices picked except for "EMPTY DEVICE". That throws off my looping,
> because the numbers aren't ever equal when these are chosen. How
> would I dip into the arrDeviceName array and trim out all of the
> "EMPTY DEVICES". Better yet, would be how to keep "EMPTY DEVICE" from
> even getting into the arrary. Currently, when I comment out the ReDim
> statment for "EMPTY DEVICE", I still get a value of "" within my
> array. This essentially is throwing off the whole calculation.
>
> I'd appreciate any input!
> Cheers,
> Matt
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts