View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Scott Scott is offline
external usenet poster
 
Posts: 3
Default IF AND THEN Statement problem

On Jun 20, 4:01*am, "Mike Fogleman" wrote:
*IfSum("J29:K29") 3600 And Range("B6").Value 21600Then

Mike F"Scott" wrote in message

...
On Jun 19, 8:58 pm, StumpedAgain





wrote:
Hey Scott,


The problem is that you are asking for a single value from multiple cells.
You'll get a 'type mismatch' error. Are you trying to sum values J29:K29?


"Scott" wrote:
Hello-


I am having trouble getting the "then" portion of my statement not to
happen when bothIFconditions are not met. The value of ("J29:K29")
is 3590 and B6 is 31600. Since both conditions are not met, I dont
want the message to appear in D21, but it does regardless.


Private Sub Breaks()


Dim myCell As Range
Set myCell = Selection
Dim ws As Worksheet
Set ws = Worksheets("AgentReport")


On Error Resume Next


IfRange("J29:K29").Value 3600 And Range("B6").Value 21600Then
Range("d21").Select
ActiveCell.FormulaR1C1 = "" & ws.Range("d3").Value & ", please make
sure to keep your Break/Lunch time under 1 hour. Thank you."
ElseIf Range("J29:K29").Value < 3600 And Range("B6").Value 21600
Then
Range("d21").Select
ActiveCell.FormulaR1C1 = ""
EndIf
myCell.Select
End Sub- Hide quoted text -


- Show quoted text -


Yes, I need the sum of J29:K29- Hide quoted text -

- Show quoted text -


I am getting an error when I use the line suggested, If Sum("j29:k29")
3600 And Range("B6").Value 21600 Then


The message says "compile error, can't find project or library" and
the word SUM in the code above is highlighted. Any ideas?