Function strlist1() As String
Dim i As Long, j As Long
Dim str As String
str = ""
For i = 1 To 5
For j = 1 To (i - 1) * 2 + 1
str = str & "×"
Next
str = str & ";"
Next
strlist1 = str
End Function
我试了一下,原来两个空格的宽度相当于一个×的宽度, 因为空格和空格之间没有间距,而×之间是有间距的,所以...
例中可以用string函数使算法更简单一点:
Function strlist5() As String
Dim i As Integer
For i = 1 To 10 Step 2
strlist5 = strlist5 & "'" & String((10 - i) * 2, " ") & String(i, "×") & "';"
Next
End Function