"While going through some old code," John Preston writes, "I found this interesting set of global variables."

```Private space1, space2, space3, space4, space5, _
space6, space7, space8, space9, space10, _
space100 As String```

"Now, what might said variables be used for?" John continued, "Why clearly, they are space counts."

```Private Sub fillSpaces()
space1 = " "
space2 = "  "
space3 = "   "
space4 = "    "
space5 = "     "
space6 = "      "
space7 = "       "
space8 = "        "
space9 = "         "
space10 = "          "
space100 = "                                                  " + _
"                                                  "
End Sub```

"Considering we already have 11 variables full of spaces, and don't want to add any more, obviously the way to go was a new function to generate spaces for us as we need them! No need for silly pad functions of Spaces(#) or other such internal functions, who trusts those things after all?

```Private Sub GenerateSpaces(ByVal SpaceCount As Integer)
Dim i, count10, remCount As Integer

NumSpaces = ""

If (SpaceCount = 100) Then
NumSpaces = space100
Else
count10 = (SpaceCount \ 10)
remCount = (SpaceCount Mod 10)
For i = 1 To count10
NumSpaces = NumSpaces & space10
Next

Select Case (remCount)
Case 1
NumSpaces = NumSpaces & space1
Case 2
NumSpaces = NumSpaces & space2
Case 3
NumSpaces = NumSpaces & space3
Case 4
NumSpaces = NumSpaces & space4
Case 5
NumSpaces = NumSpaces & space5
Case 6
NumSpaces = NumSpaces & space6
Case 7
NumSpaces = NumSpaces & space7
Case 8
NumSpaces = NumSpaces & space8
Case 9
NumSpaces = NumSpaces & space9
Case Else
End Select
End If
End Sub```

"And finally," John added, "the code that actually used these functions looked like this, because, you know, you have to keep them guessing..."

```Call GenerateSpaces(19)
Line = Line & "                  "
Line = space4
Line = Line & "                  "``` [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!