PDA

View Full Version : Solved: Time format in user form



Scooter172
06-17-2010, 01:22 PM
I have been trying to assign a user form to update cells within a workbook, But am having problems with the time format in tbxTimeswap. It displays the time in this format 03:18:57 PM and I want it in 03:18 PM Private Sub cmdSubmit_Click()
With Sheets(1)
.Range("B2").Value = tbxEmployeeNum
tbxEmployeeNum = Empty
frmDataEntry.Hide
.Range("A1").Value = tbxLRV1
tbxLRV1 = Empty
.Range("A2").Value = tbxLRV2
tbxLRV2 = Empty
.Range("A3").Value = tbxLRV3
tbxLRV3 = Empty
.Range("B1").Value = tbxRunNum
tbxRunNum = Empty
.Range("B4").Value = tbxLoc
tbxLoc = Empty
.Range("A1").Value = tbxNewLrv1
tbxNewLrv1 = Empty
.Range("A2").Value = tbxNewLrv2
tbxNewLrv2 = Empty
.Range("A3").Value = tbxNewLrv3
tbxNewLrv3 = Empty
.Range("E8,C4").Value = tbxTimeswap
Me.tbxTimeswap.Value = Format(Time())
.Range("C1").Value = tbxTripNum
tbxTripNum = Empty
frmDataEntry.Hide



End With
End Sub

Bob Phillips
06-17-2010, 01:32 PM
Me.tbxTimeswap.Text= Format(Time(),"hh:mm:ss")

p45cal
06-17-2010, 01:49 PM
xld, did you not mean "hh:mm AM/PM" ?

Scooter172
06-17-2010, 01:54 PM
Me.tbxTimeswap.Text= Format(Time(),"hh:mm:ss")
Private Sub cmdSubmit_Click()
With Sheets(1)
.Range("B2").Value = tbxEmployeeNum
tbxEmployeeNum = Empty
.Range("A1").Value = tbxLRV1
tbxLRV1 = Empty
.Range("A2").Value = tbxLRV2
tbxLRV2 = Empty
.Range("A3").Value = tbxLRV3
tbxLRV3 = Empty
.Range("B1").Value = tbxRunNum
tbxRunNum = Empty
.Range("B4").Value = tbxLoc
tbxLoc = Empty
.Range("A1").Value = tbxNewLrv1
tbxNewLrv1 = Empty
.Range("A2").Value = tbxNewLrv2
tbxNewLrv2 = Empty
.Range("A3").Value = tbxNewLrv3
tbxNewLrv3 = Empty
.Range("E8").Value = tbxTimeswap
Me.tbxTimeswap.Value = Format(Time(), "hh:mm am/pm")
.Range("C1").Value = tbxTripNum
tbxTripNum = Empty
frmDataEntry.Hide



End With
End Sub Here is what I came up with... Brain Cramp I guess!