Re: Insert formulas in VB
you use if,then,else,end if blocks:
vb Code:
if something = something then
doSomething
else
doSomethingElse
end if
Re: Insert formulas in VB
I tried the following
Private Sub UserForm_Click()
If txtFinish - txtStart >= 6.1 Then
txtLunch = 0.5
Else
txtLunch = 0
End If
End Sub
This is a string that automatically adds lunch if time from Start to Finish exceeds 6 hours.
Any ideas???
TX
Re: Insert formulas in VB
it looks like you're trying to perform arithmetic on strings. try using timespans:
vb Code:
Dim startTime As String = "05:45:00"
Dim ts1 As TimeSpan = TimeSpan.Parse(startTime)
Dim endTime As String = "12:00:00"
Dim ts2 As TimeSpan = TimeSpan.Parse(endTime)
MsgBox((ts2 - ts1).ToString)