Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
highest used area of an array ("uBound" of used area)?
I have an array that will contain an unknown number of entries. To avoid
lots of re-dimming of the array as it grows, I want to initially dim it as (1 to 10000), then if I hit 10,000 entries I want to redim it in 1000 units at a time. The problem is that I also need to keep track of how much of the array has already been used, so that I can keep adding entries in the next available slot. In the example above, uBound returns 10000 even if the array is empty. My normal practice is to keep a separate counter variable and increment it with each addition. Is this desired programming practice, or is there a way to directly determine the used size of the array from VBA? It seems more eloquent if I could use something similar to UBound to determine this value dynamically. Thanks! Keith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
highest used area of an array ("uBound" of used area)?
Counting the entries as they happen with a variable, this already happens,
yes? Seems you just need to test that or am i missing something? David "Ker_01" wrote: I have an array that will contain an unknown number of entries. To avoid lots of re-dimming of the array as it grows, I want to initially dim it as (1 to 10000), then if I hit 10,000 entries I want to redim it in 1000 units at a time. The problem is that I also need to keep track of how much of the array has already been used, so that I can keep adding entries in the next available slot. In the example above, uBound returns 10000 even if the array is empty. My normal practice is to keep a separate counter variable and increment it with each addition. Is this desired programming practice, or is there a way to directly determine the used size of the array from VBA? It seems more eloquent if I could use something similar to UBound to determine this value dynamically. Thanks! Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
error: "the copy area & the paste area are not the same size & sh | Excel Discussion (Misc queries) | |||
modifying the area plot to a "top-hat" instead of a "saw-tooth" | Charts and Charting in Excel | |||
Excel: Narrow print area to wrap to 2nd "column" on page | Excel Discussion (Misc queries) | |||
Excel: Narrow print area to wrap to 2nd "column" on page | Excel Discussion (Misc queries) | |||
What are the System Tables named "Print Area" & "Print Titles"? | Excel Programming |