将按钮的commandbutton.Caption 定义为该按钮对应的数字。用按钮 "1" 来举例
sub commandButton1_click()
text1=text1& commandButton1.caption
end sub
'------------------------------------
批量定义按钮的Caption
sub ReDimCaption()
dim n as integer
for n= 1 to n '-----n为按钮数量
userform1.controls.item("CommandButton" & n).caption=n
next x
end sub
Private Sub Command1_Click()
n = InputBox("请输入一个数字")
Text1 = Text1 & n
End Sub
text1.text=text1.text & command1.caption