View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
chemdude77 chemdude77 is offline
external usenet poster
 
Posts: 9
Default Deleting blank values from an array

Hi... newbie here. I have a 2D array that has blank values that I would like
to remove. I searched and found this code:

'Where Arr is array containing blanks and Arr2 is dynamic array
ii = 0
For i = LBound(Arr) To UBound(Arr)
If Arr(i) < "" Then
ReDim Preserve Arr2(ii)
Arr2(ii) = Arr(i)
ii = ii + 1
End If
Next

However, I am getting an error 9: subscript out-of-range for the "If Arr(i)
< "" Then" line and I can't figure out why. The only thing I can think of is
that this code is for a 1D array? Any comments? If so, how do I change the
code to remove blanks from a 2D array. Thanks!

Matt