VBA Excel - Unable to add data from form into cells

brothertruffle880
brothertruffle880 used Ask the Experts™
on
I'm trying to learn Excel VBA (see attached spreadsheet) and am putting together a simple form that takes data input by users and places it into cells.

Why am I getting error message about variable not defined?
I defined it in the label and list controls.  Or am I wrong here?
vba-lesson.xlsm
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Change module to:
Private Sub cmdAdd_Click()
Cells(12, 1).Value = Me.txtEmpName.Value
Cells(12, 2).Value = Me.lsyEmpDept.Value
Cells(12, 3).Value = Me.txtEmpEarnings.Value
End Sub

Private Sub cmdClose_Click()
Me.Hide
End Sub

Open in new window

Me - current object in VBA

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial