Excel VBA Space Function
VBA Space Function: The Space function in VBA creates a String consisting of a specified number of spaces.
Syntax
Space (Number)
Parameter
Number (required) - This parameter represents the number of spaces.
Return
This function returns a string consisting the given number of spaces.
Example 1
Sub Space_Example2() ' Creating a String containing 10 spaces. Dim str1 As String str1 = Space(10) ' The str1 is now equal to " " (10 spaces). ActiveCell.Value = str1 + "Arvind" End Sub
Output
Arvind