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:

  1. is legal assign 1 variant another, "shortarr = arr1"?
  2. if is, variants need have same bounds first?
  3. will memory usage doubled if this, or shortarr , arr1 pointers same array?

thanks in advance!

  1. is legal assign 1 variant another, "shortarr = arr1"?
  2. 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

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -