Search code examples
excelvbavariablesdeclaration

Excel VBA Variable Declaration Ambersand


In a great VBA code example @https://medium.com/@daniel.ferry/excel-vba-get-unique-values-easily-592162f52c6e there is followng Variable declaration:

Function DistinctVals(arr, Optional col = 1)
    Dim i&, v: v = arr

Everthing works fine in Windows but on Mac there is a ByRef argument type mismatch. My question is not about the mismatch - there is even Dictionary not working on Mac, but it's about the never seen before and can't find with search engine "Dim i&" Declaration. In other languages the ambersand stands for Reference, but a) this does not make sense in this context and b) it's not documented - at least I can't find any.

Dim declaration with ambersand

Thanks in advance


Solution

  • This means Long type. From VBA reference:

    The shorthand for the types is: % -integer; & -long; @ -currency; # -double; ! -single; $ -string