Thread: Syntax errot
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Syntax errot

Is A13 the name of a variable? Or is it a cell address? If a cell address,
then the assignment lines should look like this...

Range("A13").Value = "fail"

and similar for the "pass" assignment line also. As for "and" versus "or"...
I just used the logical operator you showed in your original posting (only
you know what kind of test you are performing and what the results of that
test mean).

--
Rick (MVP - Excel)


"Ed" wrote in message
...

Ran revised code with no error message. Based on numbers in file
result would be "pass", but no result at all is showing in A13.

"and" in code should be "or".





On Tue, 31 Mar 2009 14:34:01 -0400, "Rick Rothstein"
wrote:

Sorry, I forgot the "Range" part...

With Application.WorksheetFunction
If (.Min(Range("A5:A9")) < .Average(Range("A5:A9")) * 0.95) And _
(.Max(Range("A5:A9")) .Average(Range("A5:A9")) * 1.05) Then
a13 = "fail"
Else
a13 = "pass"
End If
End With