有什么方法可以做的吗?
textbox1.text = x + i
textbox2.text = x + i
textbox3.text = x + i
做这样的例子?
for l = 0 to 2
textbox(l) = x + i
next
最佳答案
假设这些控件在用户窗体中,请执行以下操作:
Private Sub FillTextboxes()
Dim i As Long
Dim x As Long
x = 10
For i = 0 To 2
Me.Controls("textbox" & i + 1).Text = x + i
Next i
End Sub
关于vba - Visual Basic-变量名称自动递增/循环,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13326871/