Consulting

Results 1 to 7 of 7

Thread: Solved: Please help tech wizards!

  1. #1

    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.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    Can you post the workbook?

    Paul

  3. #3
    Here's the workbook. Thanks.
    Last edited by lbartowski; 06-19-2010 at 11:45 AM.

  4. #4
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    [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]

    David


  5. #5

    Anyone know why this still won't work?

    Thanks Again
    Last edited by lbartowski; 06-19-2010 at 11:46 AM.

  6. #6

    Anyone know why this still won't work?

    Thanks guys
    Last edited by lbartowski; 06-19-2010 at 11:46 AM.

  7. #7
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    Change the name of your userform.

    Rename it to MyUserForm.

    David


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •