I have a working code in use & supplied below.
My issue is that it adds the new value even if the value exists,so i end up with many the same value.
What edit can i make so the code only adds new value to table if it doesnt exists.
Example,
If ABC 123 exists do not add BUT if ABC 123 is not in the table then please add it.
I didnt nothice this before so now i see a few ABC 123 values in the same table.
My issue is that it adds the new value even if the value exists,so i end up with many the same value.
What edit can i make so the code only adds new value to table if it doesnt exists.
Example,
If ABC 123 exists do not add BUT if ABC 123 is not in the table then please add it.
I didnt nothice this before so now i see a few ABC 123 values in the same table.
Private Sub AddKeyToTableList_Click()
Dim response As Integer
Dim oNewRow As ListRow
' ADD NEW KEY TYPE TO TABLE
With Sheets("INFO").ListObjects("Table38")
Set oNewRow = .ListRows.Add
oNewRow.Range.Cells(1) = Me.TextBox3.Value
.Sort.SortFields.Clear
.Sort.SortFields.Add KEY:=.ListColumns(1).Range, SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortTextAsNumbers
With .Sort
.Header = xlYes
.Apply
End With
Application.Goto (.HeaderRowRange.Cells(1))
End With
Sheets("INV").Select 'RELOAD INV WORKSHEET
ComboBox1.Value = TextBox3.Value
End Sub