View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Define an array with variable size

Hi Choi Fan,

Sub Test()
Dim Arr() As Variant
Dim i As Long

i = Range("A1").Value
ReDim Arr(1 To i)

End Sub


---
Regards,
Norman



"Yiu Choi Fan" wrote in message
...
Hi all,

In my Excel VBA program, I have to define an array, but the dimension

of
this array is a variable, which dependents on the value in cell B1. I

think
this is an easy problem but I don't know how to solve it _<

Thanks very much for your help!!

Best wishes
C.F. Yiu