I'm new to VBA and want to know if I can convert the following declaration and assignment into one line:
Dim clientToTest As String
clientToTest = clientsToTest(i)
or
Dim clientString As Variant
clientString = Split(clientToTest)
I'm new to VBA and want to know if I can convert the following declaration and assignment into one line:
Dim clientToTest As String
clientToTest = clientsToTest(i)
or
Dim clientString As Variant
clientString = Split(clientToTest)
You can sort-of do that with objects, as in the following.
Dim w As New Widget
But not with strings or variants.
There is no shorthand in VBA unfortunately, The closest you will get is a purely visual thing using the :
continuation character if you want it on one line for readability;
Dim clientToTest As String: clientToTest = clientsToTest(i)
Dim clientString As Variant: clientString = Split(clientToTest)