重复的text精简和焦点判断 达人来 送分
If Text1(0).Text = " " Or Text1(1).Text = " " Or Text1(2).Text = " " Or Text1(3).Text = " " Or Text1(4).Text = " " Or Text1(5).Text = " " Or Text1(6).Text = " " Or Text1(7).Text = " " Or Text1(8).Text = " " Or Text1(9).Text = " " Or Text1(10).Text = " " Or Text1(11).Text = " " Then
MsgBox "请输入数值! ", 48, "提示: "
1 上面的内容能精简吗?如果能代码怎么写呢?
2 点击msbox的确定后,如果Text1(0)有内容 Text1(1).Text无内容,怎么让焦点到Text1(1).Text呢
谢谢
[解决办法]
Dim i As Long
With Text1
For i = .LBound To .UBound
If Len(.Item(i)) = 0 Then
MsgBox "请输入数值! "
.Item(i).SetFocus
Exit For
End If
Next
End With