+ Reply to Thread
Results 1 to 2 of 2

Excel userform with date textboxes not filled out.

  1. #1
    Registered User
    Join Date
    10-06-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Exclamation Excel userform with date textboxes not filled out.

    Hi All. I have setup a userform with many textboxes and all i am seeking to do is transfer the userform info onto my spreadsheet. The code i have is;

    Private Sub CommandButton2_Click()

    Sheet2.Range("B3").Value = TextBox1.Text
    Sheet2.Range("B11").Value = TextBox12.Text
    Sheet2.Range("B12").Value = TextBox2.Text
    Sheet2.Range("B19").Value = TextBox15.Value
    Sheet2.Range("B22").Value = TextBox16.Value
    Sheet2.Range("B25").Value = TextBox17.Value
    Sheet2.Range("D12").Value = DateValue(Me.TextBox3.Value)
    Sheet2.Range("B13").Value = TextBox4.Text
    Sheet2.Range("D13").Value = DateValue(Me.TextBox5.Value)
    Sheet2.Range("B14").Value = TextBox6.Text
    Sheet2.Range("D14").Value = DateValue(Me.TextBox7.Value)
    Sheet2.Range("B15").Value = TextBox8.Text
    Sheet2.Range("D15").Value = DateValue(Me.TextBox9.Value)
    Sheet2.Range("B17").Value = TextBox10.Value
    Sheet2.Range("B16").Value = TextBox11.Value
    Sheet2.Range("F10").Value = DateValue(Me.TextBox14.Value)
    Sheet2.Range("B7").Value = DateValue(Me.TextBox13.Value)

    MsgBox "One record written to Superfund details Sheet"

    Unload Me


    End Sub

    The problem is that i have six date fields (representing dates of birth and other important dates), and not all of these are required to be filled out by the user (ie - they are not mandatory). Problem is that if the user does not fill them out i get the runtime error 13 message "type mismatch", and the debugger is struggling with the fact that all date fields are not filled out. Does anyone know how to fix this? Cheers.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Excel userform with date textboxes not filled out.

    Welcome to the forum.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1