Why not create a dynamic array and then use Ubound(array) to find the number of items ??
From VBA help:
Declaring a Dynamic Array
By declaring a dynamic array, you can size the array while the code is running. Use a Static, Dim, Private, or Public statement to declare an array, leaving the parentheses empty, as shown in the following example.
Dim sngArray() As Single
Note You can use the ReDim statement to declare an array implicitly within a procedure. Be careful not to misspell the name of the array when you use the ReDim statement. Even if the Option Explicit statement is included in the module, a second array will be created.
In a procedure within the array's scope, use the ReDim statement to change the number of dimensions, to define the number of elements, and to define the upper and lower bounds for each dimension. You can use the ReDim statement to change the dynamic array as often as necessary. However, each time you do this, the existing values in the array are lost. Use ReDim Preserve to expand an array while preserving existing values in the array. For example, the following statement enlarges the array varArray by 10 elements without losing the current values of the original elements.
ReDim Preserve varArray(UBound(varArray) + 10)
HTH
~Geoff~
![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)