Hey guys,
First Post here, and I'm relatively new to VBA, and I use Excel Forums when I'm stumped, so hopefully I can get some help here.
I created the Userform Below:
Userform.png
Basically What I want is to input all this information, have the Textboxes recognize "hh:mm" Format, and have the labels calculate the difference in time, and then add up those labels to have Total Machine Hours. Once I have that, I can input the cases produced, Click "Complete", and have that information transferred to a Database Starting with Cell "A2" in ws "Sheet1".
I've been running into walls, and I can't waste too much time on it. Here is the Code I have so far:
Private Sub UserForm_Initialize()
ComboBox1.List = Sheets("MVLU").Range("L2:L128").Value
End Sub
Private Sub TextBox1_AfterUpdate()
If IsDate(Me.TextBox1.Text) Then
Me.TextBox1.Text = Format(Me.TextBox1.Text, "mm/dd/yyyy")
End If
End Sub
Private Sub TextBox2_AfterUpdate()
If IsDate(t) Then
Me.TextBox2.Value = Format(Time, "hh:mm")
End If
End Sub
Private Sub TextBox3_AfterUpdate()
If IsDate(t) Then
Me.TextBox3.Value = Format(Time, "hh:mm")
End If
End Sub
Private Sub Combobox1_Change()
Label16.Caption = Application.WorksheetFunction. _
VLookup(Val(ComboBox1.Text), Worksheets("MVLU").Range("L2:M128"), 2, False)
End Sub
Private Sub TextBox3_Change()
With Me
Label17 = Val(.TextBox3.Text) - Val(.TextBox2.Text)
End With
Label17 = Format(Label17, "hh:mm")
End Sub
However, It continues to give me issues. Please help!
Bookmarks