7,762
社区成员
发帖
与我相关
我的任务
分享
Dim strAll As String
Dim i As Long
For i = 0 To 7
strAll = strAll & Text(i) & "-"
Next i
If InStr(strAll, "--") Then
MsgBox "有重复。"
End If
Private Sub Form_Load()
Dim a As Object
Dim arr(7) As String
For Each a In Me.Controls
If TypeOf a Is TextBox Then
arr(i) = a.Text
i = i + 1
Debug.Print a.Name
End If
Next
For i = 0 To 6
For j = i + 1 To 7
If arr(i) = arr(j) Then
MsgBox "第" & 8 - j & "个文本框内容" & "和" & 8 - i & "个相同"
End If
Next j
Next i
End Sub
for i=0 to 7
for j=i+1 to 7
if text(i)=text(j) then
msgbox i & "和" & j & "相同"
end if
next j
next i