Thread: Wrong output
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Wrong output

Hi Steven,

Steven E. wrote:
when I want to get the operator from a conditional format in Excell,
the formula returns a:

"1" for "between
"5" for greather than
..

The formula I use is

Cells(Row, 2) = Cell.FormatConditions(1).Operator

with

Cell As Range

Is this a wrong declaration or do I have to change something else in
my formula.


Not quite sure what you're looking for. If you want the actual operator
(ie, "", "<", "=", "between"), you'll have to write it back based on the
constant returned from the Operator property. Here's an example of a
user-defined function:

Public Function GetCFOperator(rngTarget As Range, _
Optional nCFIndex As Integer = 1) As Variant
On Error GoTo ErrHandler

Select Case rngTarget.FormatConditions(nCFIndex).Operator
Case xlLess
GetCFOperator = "<"
Case xlGreater
GetCFOperator = ""
Case xlBetween
GetCFOperator = "between"
Case xlEqual
GetCFOperator = "="
Case Else
GetCFOperator = "other"
End Select

ExitRoutine:
Exit Function
ErrHandler:
GetCFOperator = CVErr(1004)
Resume ExitRoutine
End Function


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]