[英]How to repeat one cell value X times in another cell?
Use a UDF. 使用UDF。
Press Alt + F11 then right click in the Project
column. 按Alt + F11,然后右键单击“
Project
列。 Insert a new module and paste the code in module1. 插入一个新模块,并将代码粘贴到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
Then back to your worksheet, typing textmul(A2,B2)
generates the result. 然后回到您的工作表,键入
textmul(A2,B2)
生成结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.