C
cluck
I have a button on a user form that after entering data when clicked should
enter the data at the bottom of a list in Excel.
However when I attempt to run the code I get a "User-defined type not
defined".
What am I doing wrong?
Private Sub fAdd_Click()
Dim NewRow As Interger ' HERE is where the error is highlighted.
NewRow = Worksheets("main").Range("a1").Value + 1
If Len(MyForm.fname.Value) = 0 Then
MsgBox "The name field cannot be left empty", vbOKOnly, ""
MyForm.fname.SetFocus
Exit Sub
End If
Worksheets("table").Cells(NewRow, 1).Value = MyForm.fname.Value
Worksheets("table").Cells(NewRow, 2).Value = MyForm.fSocial.Value
MyForm.Hide
End Sub
enter the data at the bottom of a list in Excel.
However when I attempt to run the code I get a "User-defined type not
defined".
What am I doing wrong?
Private Sub fAdd_Click()
Dim NewRow As Interger ' HERE is where the error is highlighted.
NewRow = Worksheets("main").Range("a1").Value + 1
If Len(MyForm.fname.Value) = 0 Then
MsgBox "The name field cannot be left empty", vbOKOnly, ""
MyForm.fname.SetFocus
Exit Sub
End If
Worksheets("table").Cells(NewRow, 1).Value = MyForm.fname.Value
Worksheets("table").Cells(NewRow, 2).Value = MyForm.fSocial.Value
MyForm.Hide
End Sub