erutherford
Active Member
- Joined
- Dec 19, 2016
- Messages
- 458
I have a table with headers (starting in A1), nothing fancy. I have a form that controls the data that is entered, works fine.
If the table is empty with only the headers there, I get an error (at the Range statement). If cell A2 has something in it it works fine and finds the last row.
has to be something simple and I am looking right at it! Just don't see it!
If the table is empty with only the headers there, I get an error (at the Range statement). If cell A2 has something in it it works fine and finds the last row.
Code:
Private Sub CommandButton1_Click()
Range("A1").End(xlDown).Offset(1, 0).Select
'FN
If TextBox1.Value = "" Then
MsgBox "First Name Required!", vbCritical
UserForm1.TextBox1.SetFocus
Exit Sub
End If
'LN
If TextBox2.Value = "" Then
MsgBox "Last Name Required!", vbCritical
UserForm1.TextBox2.SetFocus
Exit Sub
End If
'US - Enters Data to Table
ActiveCell = TextBox1.Value 'FN
ActiveCell.Offset(0, 1) = TextBox2.Value 'LN
Unload UserForm2
End Sub
has to be something simple and I am looking right at it! Just don't see it!
Last edited by a moderator: