
- VBA Tutorial
- VBA - Home
- VBA - Overview
- VBA - Excel Macros
- VBA - Excel Terms
- VBA - Macro Comments
- VBA - Message Box
- VBA - Input Box
- VBA - Variables
- VBA - Constants
- VBA - Operators
- VBA - Decisions
- VBA - Loops
- VBA - Strings
- VBA - Date and Time
- VBA - Arrays
- VBA - Functions
- VBA - Sub Procedure
- VBA - Events
- VBA - Error Handling
- VBA - Excel Objects
- VBA - Text Files
- VBA - Programming Charts
- VBA - Userforms
- VBA Useful Resources
- VBA - Quick Guide
- VBA - Useful Resources
- VBA - Discussion
VBA - Space
The Space function fills a string with a specific number of spaces.
Syntax
space(number)
Parameter Description
Number − A required parameter. The number of spaces that we want to add to the given string.
Example
Private Sub Constant_demo_Click() Dim var1 as Variant var1 = "Microsoft" Dim var2 as Variant var2 = "VBScript" msgbox(var1 & Space(2)& var2) End Sub
When you execute the above function, it produces the following output.
Microsoft VBScript
vba_strings.htm
Advertisements