I have a spreadsheet with a userform used to add entries to a mapping table of items. There are four fields which need to be input and once done the entries are appended to the bottom of a table.
What I need to do is get the code that inputs the data to look for a duplicate entry for the first entry and if it finds one to then overwrite it instead of append to the bottom.
Here's my existing code
Is this possible?
What I need to do is get the code that inputs the data to look for a duplicate entry for the first entry and if it finds one to then overwrite it instead of append to the bottom.
Here's my existing code
Code:
Private Sub cmdAdd_Click() 'Copy input values to sheet.
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Contract mapping")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.MACCode.Value
.Cells(lRow, 2).Value = Me.OurCode.Value
.Cells(lRow, 3).Value = Me.CallPutFuture.Value
.Cells(lRow, 4).Value = Me.Multiplier.Value
End With
'Clear input controls.
Me.MACCode.Value = ""
Me.OurCode.Value = ""
Me.CallPutFuture.Value = ""
Me.Multiplier.Value = ""
End Sub
Is this possible?