[RESOLVED] assign variable to array size
HI,
I have done this in VB6 but it is possible to assign a variable created to an array size in VBA?
Say'
Dim maxtblApproverRecords As Integer
maxtblApproverRecords = 7
Dim approverNames(maxtblApproverRecords - 1) As Variant
It keeps getting me "constant expression expected". How do I do it otherwise?
Thanks.
Re: assign variable to array size
It's the same as in VB6.. declare the array without a size, then use ReDim to set the size.
Re: assign variable to array size
Also, look into the Preserve argument of ReDim if you need to adjust the array size without loosing the data already populated in it.
Re: assign variable to array size
Cheers,
Thanks for your prompt reply. That worked very well.