Hello,
I have a userform with 8 textboxes (txt_Name1, txt_Name2...txt_Name8)
I'm trying to add a piece of code to check the textboxes above if any name is duplicate, I tried the following code but didn't work
Can you please help me?
Code:
Private Sub cmd_Add_Clich()
Dim i As Long
For i = 1 To cmb_Num.value 'cmb_Num is a list (1 to 8)
If Me.Controls("txt_Name" & i) = Me.Controls("txt_Name" & i) Then
Me.lbl_Alert.Caption = "The name of User " & i & " is already exist!!!"
Me.Controls("txt_Name" & i).SetFocus
Exit Sub
End If
Next i
I have a userform with 8 textboxes (txt_Name1, txt_Name2...txt_Name8)
I'm trying to add a piece of code to check the textboxes above if any name is duplicate, I tried the following code but didn't work
Can you please help me?
Code:
Private Sub cmd_Add_Clich()
Dim i As Long
For i = 1 To cmb_Num.value 'cmb_Num is a list (1 to 8)
If Me.Controls("txt_Name" & i) = Me.Controls("txt_Name" & i) Then
Me.lbl_Alert.Caption = "The name of User " & i & " is already exist!!!"
Me.Controls("txt_Name" & i).SetFocus
Exit Sub
End If
Next i