|
Private Sub CommandButton1_Click()
Dim text(1 To 4) As String
text(1) = TextBox1.Value
text(2) = TextBox2.Value
text(3) = TextBox3.Value
text(4) = TextBox4.Value
If text(1) = "" Then
MsgBox ("么么,填完内容啊亲!")
Else
Row = [b33656].End(3).Row + 1
Cells(Row, 1).Value = Date
For i = 2 To 5 Step 1
Cells(Row, i).Value = text(i - 1)
Next
For i = 1 To 4Me.Controls("TextBox" & i) = ""Next i
End If
End Sub
这个代码就没有错,但是如果将其中的倒数3-5行换成:
dim ctr as control
for each ctr in me.controls
if typeof ctr is textbox then
ctr.text=""
end if
next
这样的话,就不行!。。为什么呢,求指教呀~~~~~~~~~
还有就是哦~vba里面能够建立控件数组的吗?
虽然有个好方法,就是这个me.controls("textbox"&i)了、、{:soso_e103:}
|
|