1
你能不能幫我把我的問題,我想在我的程序出現的情況是,當你在這樣的「文森特」用戶窗體鍵入一個名稱以文本框將傳遞到片以相同的方式大寫名稱在VBA中的第一個字母
Private Sub cmdAdd_Click()
If cmdAdd.Caption = "ADD" Then
txtName.Enabled = True: cboAge.Enabled = True:
cmdAdd.Caption = "SAVE": cmdClose.Caption = "CANCEL"
txtName.SetFocus
Else
If txtName.Text = "" Or cboAge.Text = "" Then
MsgBox "Required field(s) missing!", vbCritical, "Message"
Else
For i = 2 To Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
If LCase(txtName.Text) = Sheet1.Cells(i, 1).Value And _
cboAge.Text = Sheet1.Cells(i, 2).Value Then
MsgBox "Record already exist!", vbExclamation, "Message"
Call UserForm_Activate
Exit Sub
End If
Next i
r = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheet1.Cells(r, 1).Value = (txtName.Text)
Sheet1.Cells(r, 2).Value = cboAge.Text
r = 0
MsgBox "One record saved!", vbInformation, "Message"
Call UserForm_Activate
End If
End If
End Sub
這是你能幫助我的代碼..thank你
謝謝你對我的幫助......其工作 – Vincent