.
This will get you started ...
Option Explicit
Private Sub btnCancel_Click()
Unload Me
End Sub
Private Sub btnOK_Click()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim newRow As Long
newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1
'The next two lines can be expanded as many times as needed for all the entry fields in your project
ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
ws.Cells(newRow, 2).Value = Me.txtSurname.Value
End Sub
Sub CommandButton1_Click()
Selection.EntireRow.Delete
End Sub
The example code provide for entering a FIRST name and a LAST name to the worksheet. It can be edited to enter both at the same time, to a single cell.
The code also provides for deleting an entire row on the sheet should that be required. The user selects a cell in the row to be deleted, then clicks the button.
And there is a basic command for unloading the userform.
Suggest you study the code and the attached example for a better understanding. You can build the remainder of your project from here.
NOTE: the coded will 'write' data to the ACTIVESHEET.
Bookmarks