-
Solved: Please help tech wizards!
I'm hoping one of you tech wizards could help out a newbie with some basic VBA code for a userform. Here's what I have on a user form. I'm getting an error message.
2 Labels:
1. Please enter your first name:
2. Please enter the year you were born:
then click OK
after they click OK I need for a "lblOut" to read: "You are -- years old"
Then I would like to give them a line that says "correct?" with a yes or no option.
If yes then "Yippee!" Else "Your B-day must be coming up!"
THIS IS OVER MY HEAD! Any help is appreciated.
-
Can you post the workbook?
Paul
-
Here's the workbook. Thanks.
Last edited by lbartowski; 06-19-2010 at 11:45 AM.
-
[vba]Private Sub CommandButton1_Click()
Dim vName, vYear
vName = txtName.Text
vYear = txtYear.Text
lblOut.Caption = vName & ", you're " & Val(2010 - vYear) & " years old."
End Sub[/vba]
-
Anyone know why this still won't work?
Last edited by lbartowski; 06-19-2010 at 11:46 AM.
-
Anyone know why this still won't work?
Last edited by lbartowski; 06-19-2010 at 11:46 AM.
-
Change the name of your userform.
Rename it to MyUserForm.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules