Hello, I have a userform that I use to enter data in a workbook and all that works well. Currently I time stamp the entry using the Now() function when the data is entered. On the equipment that is being inspected there is a timer that gives us the amount of elapsed time when it performed a particular action. I want to tweak the form by adding a text box where the user can add the value on the timer (it is "X" number of minutes) into the text box and then have the code subtract that value from the now() when the code is executed. This would give us a rough estimate of when that particular action occurred.
Originally the string for the time stamp was ".Range("D" & nextrow) = Now()" Not knowing exactly where to start I tried something simple like adding the "TimeLog.Value" to the string:
wasn't surprised it didn't work, thinking that the code does not know the value in the text box is minutes, so I need to resolve that at least. Can anyone offer suggestions on how to go forward? I appreciate any input - thanks,
Originally the string for the time stamp was ".Range("D" & nextrow) = Now()" Not knowing exactly where to start I tried something simple like adding the "TimeLog.Value" to the string:
VBA Code:
Private Sub EnterData_Click()
Dim nextrow As Long
'some code here....
'transfer the data
With ActiveSheet
nextrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & nextrow) = ChemicalBox.Value
.Range("B" & nextrow) = LotNumber.Value
.Range("C" & nextrow) = TechName.Value
.Range("D" & nextrow) = TimeLog.Value - Now()
.Range("G" & nextrow) = CommentBox.Value
End With
End Sub
wasn't surprised it didn't work, thinking that the code does not know the value in the text box is minutes, so I need to resolve that at least. Can anyone offer suggestions on how to go forward? I appreciate any input - thanks,