Wrong output

  • Thread starter Thread starter Steven E.
  • Start date Start date
S

Steven E.

Hi,

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 m
formula.

Thanks
Steve
 
Hi Steven,
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top