Results 1 to 3 of 3

User Form Data Entry Adding a TimeStamp

Threaded View

  1. #1
    Registered User
    Join Date
    03-07-2015
    Location
    pigeon forge tn
    MS-Off Ver
    2010
    Posts
    14

    User Form Data Entry Adding a TimeStamp

    Im trying to get a TimeStamp in with my code i already have and its not working.

    Here is what I have:
    Sub cmdSubmit_Click()
        Dim ctl As Control
        'Check User Input
           If Me.txtApparatus.Value = "" Then
    MsgBox "Please enter Apparatus.", vbExclamation, "Form Error"
    Me.txtApparatus.SetFocus
         Exit Sub
        End If
        If Me.txtReporter.Value = "" Then
    MsgBox "Please enter your Name.", vbExclamation, "Form Error"
    Me.txtReporter.SetFocus
                           
             Exit Sub
        End If
          
    'Write data to worksheet
    
        'Copy input values to sheet.
        Dim lRow As Long
        Dim ws As Worksheet
        Set ws = Worksheets("Maintenance")
        lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        With ws
            .Cells(lRow, 1).Value = Me.txtApparatus.Value
            .Cells(lRow, 2).Value = Me.txtAppearance.Value
            .Cells(lRow, 3).Value = Me.cboPriority1.Value
            .Cells(lRow, 4).Value = Me.txtMechanical.Value
            .Cells(lRow, 5).Value = Me.cboPriority2.Value
            .Cells(lRow, 6).Value = Me.txtElectrical.Value
            .Cells(lRow, 7).Value = Me.cboPriority3.Value
            .Cells(lRow, 8).Value = Me.txtReporter.Value
            .Cells(1Row, 9).Value = Format(Now, "dd/mm/yyyy hh:nn:ss")  ""This is the only error it gives me""
        End With
         
           'Clear the form
    For Each ctl In Me.Controls
    If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
    ctl.Value = ""
    
        Unload Me
        End If
        Next ctl
    End Sub
    Last edited by Leith Ross; 03-14-2015 at 02:09 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. User Form Data Entry
    By caltman242 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2015, 04:36 AM
  2. I need to make data entry user form
    By gunatilake.dayan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2014, 10:35 AM
  3. Select user form with data entry
    By itsunclebill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2010, 12:07 AM
  4. User Form for Data Entry In Excel
    By tariqnaz2005 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2009, 09:40 AM

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