There are times you need to assign a string variable with a specific character repeated a specific number of times. VBA provides two main functions for this purpose:
String
/String$
Space
/Space$
.Dim lineOfHyphens As String
'Assign a string with 80 repeated hyphens
lineOfHyphens = String$(80, "-")
Dim stringOfSpaces As String
'Assign a string with 255 repeated spaces using Space$
stringOfSpaces = Space$(255)
'Assign a string with 255 repeated spaces using String$
stringOfSpaces = String$(255, " ")