In VBA
only C is Long, a & b are Variants ... whereas in .NET a, b & c would all be Long![]()
Dim a, b, c As Long
As to why your code works ... VBA is designed for non-programmers ie there is the expectation that Variables may not be declared at all - hence Option Explicit is not default setting.
Anything not declared explicitly is assiged a Variant and a Variant can be anything hence the code works regardless...
General school of thought is: Variants = Inefficient/Expensive, however, I've heard MS MVP's say recently (Simon Hodge) that they think that's not really that significant an issue in VBA and that in reality all Cells are Variants (and there are lots of those without impacting performance!).
Note: In .NET, code is Option Explicit and the Variant type no longer exists (one must use Object)
Bookmarks