Thank you mehmetcik. This is very helpful.
All of that works, but when I click the "Save Changes" button on the ContactEdit userform, it still adds a new row to the table instead of overwriting the existing row.
How do I change this code to make it overwrite? I know it has to do with the LastRow portion, I just don't know what to change that to. (I am only posting the first part of the code since the bottom part is just more of the same.)
Private Sub CmdSaveChanges_Click()
Dim rng As Range
Dim LastRow As Long
Set rng = ActiveSheet.ListObjects("ContactCenter").Range
LastRow = rng.Find("*", rng.Cells(1), xlFormulas, xlPart, xlByRows, xlPrevious, False).Row
Cells(LastRow + 1, 3).Value = TextBox1.Value
Cells(LastRow + 1, 4).Value = TextBox2.Value
' repeat with rest of the lines
End Sub
Also, I have this code to clear the form, but it does not clear everything. I found this on another site. How can I change this to completely clear the form?
Dim ctl As Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
ctl.Value = ""
Case "ComboBox", "ListBox"
ctl.ListIndex = -1
End Select
Next ctl
I really appreciate your help.
Bookmarks