-5

我想使用命令按钮使用逗号在单元格中打印特定值 10 次或更多次。谁能解释如何为此编写宏?

当我单击命令按钮时,该值应在活动单元格中打印所需的时间。数据非常庞大,因此手动输入单个单元格并输入它非常困难。

4

1 回答 1

1

将其放入您的 Commandbutton_Click 事件处理程序中:

Dim strValueToPrint as String, strOutput as String
Dim intRepeatCount as Integer, i as Integer

strValueToPrint = "1" 'Change this to be the value that you want to repeat
for i = 1 to intRepeatCount
    strOutput = strOutput & strValueToPrint & ","
Next
Activecell.Value = strOutput
于 2013-03-13T10:19:43.000 回答