Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: "the copy area & the paste area are not the same size & sh Janis Excel Discussion (Misc queries) 1 September 7th 07 10:58 PM
modifying the area plot to a "top-hat" instead of a "saw-tooth" Curious27 Charts and Charting in Excel 9 June 16th 06 03:56 AM
Excel: Narrow print area to wrap to 2nd "column" on page wood nerd Excel Discussion (Misc queries) 1 May 4th 06 02:24 AM
Excel: Narrow print area to wrap to 2nd "column" on page wood nerd Excel Discussion (Misc queries) 0 May 4th 06 12:11 AM
What are the System Tables named "Print Area" & "Print Titles"? Tom Ogilvy Excel Programming 1 August 18th 03 05:38 PM


All times are GMT +1. The time now is 09:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"