x = ComboBox1.Text + ComboBox2.Text + ComboBox3.Text
For i = 2 To Sheets("工作單1").[B36656].End(xlUp).Row
If Cells(i, "B") = x Then
MsgBox "有重復資料", vbInformation
Exit For
Else
Cells(r, "C") = TextBox2.Text
Cells(r, "B") = ComboBox1.Text + ComboBox2.Text + ComboBox3.Text
Cells(r, "A") = TextBox1.Text
End If
Next
If x = "" Then
MsgBox "輸入資料", vbInformation
End If作者: 軒云熊 時間: 2020-11-24 12:56
Public Sub 練習1124()
'x = "11112(黃)AAA2" '有輸入
x = "" '沒輸入
E = False
101: If E = True Then x = "11112(黃)AAA2"
For i = 2 To Sheets(1).Cells(Rows.Count, 2).End(xlUp)(2).Row
If Cells(i, "B") = x And Cells(i, "B") <> "" Then
MsgBox "有重復資料", vbInformation
Exit For
ElseIf Cells(i, "B") = "" Then
Cells(i, "A") = "111"
Cells(i, "B") = "11112(黃)AAA2"
Cells(i, "C") = "10"
ElseIf x = "" Then
MsgBox "輸入資料", vbInformation
E = True: GoTo 101
End If
Next i