Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting blank values from an array
Matt,
How about putting this line in your code temporarily to see what is going on: MsgBox "i: " & i I'd put it right after the "For i = blah blah.... Alan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting blank values from an array
Hi Alan,
Thanks for the help, that tip should definitely help me debug in the future. I ended up changing the code so that a 1D array will work and now I am getting acceptable results. My philosophy is to make the program as simple as possible at first and then add more difficult-to-code extras later on once I at least have a working version. Matt "alan_stew" wrote: Matt, How about putting this line in your code temporarily to see what is going on: MsgBox "i: " & i I'd put it right after the "For i = blah blah.... Alan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not showing blank and non blank items in filter mode for values | Excel Worksheet Functions | |||
Deleting all but one blank row | Excel Discussion (Misc queries) | |||
deleting values in a worksheet without deleting the formulas | Excel Worksheet Functions | |||
Deleting blank values from an array | Excel Programming | |||
Deleting element in Array | Excel Programming |