This code is no good:
Private Sub TextBox1_Change()
Cells(emptyRow, 1).Value = TextBox1.Value
Cells(emptyRow, 2).Value = TextBox2.Value
End Sub
I think you may be trying to do something like this:
Private Sub okemp_Click()
Dim ws As Worksheet: Set ws = Sheets("Database")
Dim lastrow As Long
lastrow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1
If TextBox1.Value <> "" And TextBox2.Value <> "" Then
ws.Range("A" & lastrow).Value = TextBox1.Value
ws.Range("B" & lastrow).Value = TextBox2.Value
Else
MsgBox ("you must enter an ID# and Name")
End If
Application.Goto Worksheets("Test 1").Range("A1")
End Sub
Note: You are probably going to have a few problems with the code in the future. You might want to consider such things as sheet references, error checking, etc. If this spreadsheet is part of your work or a profesional function, I would consider paying for someones services to help you build it completely.
Bookmarks