Written by Administrator
|
luned́, 24 dicembre 2007 |
ReDim instruction is used to resize an array. It is useful to save memory in case you have an array too big for your purpose or for dinamic array management. It ca be used in conjunction with Preserve parameter, in case you want the data already memorized not to be erased Sub redm() Dim arr() As String ReDim arr(0)
arr(0) = "value1" ReDim Preserve arr(2) 'now: three element array arr(1) = "value2" arr(2) = "value3"
End Sub In the example above the one element array is extended to a three element one. The ReDim parameter includes also the 0 value: you have to consider then the number of elements based on n-1 formula.
|
Last Updated ( luned́, 24 dicembre 2007 )
|