IF AND THEN Statement problem
Sum() is not a valid vba method as far as I know.
As long as you are only adding the two cells I would just create a new
variable to add the ranges.
The code below assumes that the seconds values in cells J29, K29, and
B6 are all whole numbers. If your telephony system reports fractions
of seconds and that carries over to your spreadsheet you should change
the variable type.
Private Sub Breaks()
Dim ws As Worksheet
Set ws = Worksheets("AgentReport")
Dim lngBreakLunchSum As Long
lngBreakLunchSum = Range("J29").Value + Range("K29").Value
On Error Resume Next
If lngBreakLunchSum 3600 And Range("B6").Value 21600 Then
Range("d21").Value = ws.Range("d3").Value & ", please make
sure to keep your Break/Lunch time under 1 hour. Thank you."
ElseIf lngBreakLunchSum < 3600 And Range("B6").Value 21600 Then
Range("d21").Value = ""
End If
End Sub
|