Dear Tom Ogilvy,
i have the following codes but when the data is already exit, it again
append whether it is a new record or not.
Private Sub cmdAdd_Click()
Dim ws As Worksheet
Dim irow As Long
Dim rng As Range
Set ws = Worksheets("code")
With ws
Set rng = .Range(.Range("a2"), .Range("a2").End(xlDown))
End With
res = Application.Match(keyIDValueofnewrecord, _
rng, 0)
If IsError(res) Then
irow = ws.Cells(Rows.Count, 1) _
..End(xlUp).Offset(1, 0).Row
If Me.TextBox1.Value = "" Then
Me.TextBox1.SetFocus
MsgBox "Please Enter the Code"
Exit Sub
End If
ws.Cells(irow, 1).Value = Me.TextBox1.Value
ws.Cells(irow, 2).Value = Me.TextBox2.Value
ws.Cells(irow, 3).Value = Me.ComboBox1.Value
ws.Cells(irow, 4).Value = Me.TextBox3.Value
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.ComboBox1.Value = ""
Me.TextBox3.Value = ""
Else
MsgBox "Data is already entered"
End If
End Sub
Where i am wrong. Please help me
SYED HAIDER ALI