View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Unlimited number of variables?

Use an array. In the below example variable arrTemp is redimensioned at
runtime to store values 1 to 1000..at position 1 to 1000...

http://msdn.microsoft.com/en-us/libr...s2(VS.71).aspx

Dim arrTemp As Variant
ReDim arrTemp(0)

For intCount = 1 To 1000
ReDim Preserve arrTemp(intCount)
arrTemp(intCount) = intCount
Next

--
Jacob


"Faraz A. Qureshi" wrote:

Sometimes you never know how many variables you would be needing to gather a
data.

For example, =SUM(Variable-1, Variable-2, ...., Variable-n)

How to declare the same in this regard? Any sample shall be appreciated.

--
Thanx in advance,
Best Regards,

Faraz