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 |
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 |
All times are GMT +1. The time now is 02:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com