Assigning one Variant to Another in Excel VBA -
so have 2 (not adjacent) columns of data on excel worksheet, different numbers of entries. load data 2 variants called arr1 , arr2. in processing follows, want refer columns fewest , entries, define 2 variant variables called shortarr , longarr, , assign arr1 , arr2 them according ubound() larger. questions are:
- is legal assign 1 variant another, "shortarr = arr1"?
- if is, variants need have same bounds first?
- will memory usage doubled if this, or shortarr , arr1 pointers same array?
thanks in advance!
- is legal assign 1 variant another, "shortarr = arr1"?
- if is, variants need have same bounds first?
yes quite normal. can assign till time, second array not dimensioned.
option explicit sub sample() dim arr1(1 2), arr2() arr1(1) = 2: arr1(2) = 3 arr2 = arr1 msgbox arr2(2) end sub
will memory usage doubled if this, or shortarr , arr1 pointers same array?
yes. pointers different array.
Comments
Post a Comment