Variant Data Type
Using the Variant data type is generally a waste of memory because the Variant data type consumes more memory than the other data types.
Every time a Variant data type is used VBA has to repeatedly check and reserve memory dynamically which all takes time.
The following two lines of code are equivalent.
Dim sFirstName As Variant
Using a Variant data type may be useful sometimes but generally this should be avoided.
Because you know that FirstName will always contain a string you should declare this variable as:
Dim sFirstName As String
© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext