Reputation: 1330
Recently I have been using the dictionary object to make arrays with unique values only by taking advantage of the .exists
method which is simpler than writing a loop through the entire array every time to see if a value exists. Then I get the final array by using the .keys
method.
Given that the dictionary object requires a definition for each key, I have gone back and forth on what to set as the definition. Originally I was setting each key's definition to the vbempty
constant since I have no use for it anyways. But would the best practice here be to use a Null
value because it would take up less memory?
Upvotes: 0
Views: 79
Reputation: 2975
vbNullString
is the most efficient and should be used when you wish to assign an empty string (or when you wish to assess for an empty string).
Using vbNullString
does not use any memory. If you're assigning vbNullString
to a variable which previously held a value, it removes any space that was previously being used from the memory. Using ""
uses 6 bytes. Not sure how many bytes is used by vbEmpty
or Null
, but I always use vbNullString
.
There is an explanation here and here.
Upvotes: 1