View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin Beckham Kevin Beckham is offline
external usenet poster
 
Posts: 78
Default excluding a value in a max determination

not elegant but...

first = True
For Each c In myRange
With c.Interior
If .ColorIndex < 2 Or .Pattern < xlLightUp Or _
.PatterColorIndex < 22 Then
If first Then
max = c.Value
first = False
ElseIf c.Value max Then
max = c.Value
End If
End If
End With
Next c
MsgBox "Max = " & max


Kevin Beckham

-----Original Message-----
Hi

I want to determine a max value in a range: =MAX(A1:A3)

But if one of the cells has this format:

With Selection.Interior
.ColorIndex = 2
.Pattern = xlLightUp
.PatternColorIndex = 22
End With

I want to exclude it from the max value determination.

Can anybody help me out with a piece of code that returns
the correct max value?

Thank you
Schwartz
.