PDA

View Full Version : Solved: Please help tech wizards!



lbartowski
06-18-2010, 11:09 AM
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.

Paul_Hossler
06-18-2010, 12:07 PM
Can you post the workbook?

Paul

lbartowski
06-18-2010, 12:42 PM
Here's the workbook. Thanks.

Tinbendr
06-18-2010, 01:16 PM
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

lbartowski
06-18-2010, 02:18 PM
Thanks Again

lbartowski
06-18-2010, 02:21 PM
Thanks guys

Tinbendr
06-18-2010, 03:27 PM
Change the name of your userform.

Rename it to MyUserForm.