Results 1 to 6 of 6

Unfilled textboxes in userform creating problems.

Threaded View

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

    Cool Unfilled textboxes in userform creating problems.

    Hi All.

    Sorry.....only new to this forum and posted this on my welcome page.

    Anyway.....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.
    Last edited by barmfield; 10-07-2012 at 01:52 AM. Reason: Problem Solved

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