答案 0 :(得分:2)
使用UDF。
按 Alt + F11 ,然后右键单击Project
列。插入一个新模块,并将代码粘贴到module1中。
Public Function textMul(ByVal target As String, ByVal n As Long) As String
Dim tmpStr As String
Dim i As Long
For i = 1 To n
If tmpStr <> "" Then tmpStr = tmpStr & ", "
tmpStr = tmpStr & target & "-" & i - 1
Next i
textMul = tmpStr
End Function
然后返回工作表,键入textmul(A2,B2)
即可生成结果。