Multiple Variables

This statement is valid although the variable sFirstName is defined as a Variant variable and not as a string variable.

Dim sFirstName, sLastName As String 

VBA does not let you declare a group of variables to all be of the same datatype.
You must specify the type of each variable explicitly.
You should always try and declare each variable on a separate line

Dim sFirstName As String 
Dim sLastName As String

You could put this on one line

Dim sFirstName As String, sLastName As String 


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext