MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Conditional formatting?

  Asked By: John    Date: Sep 16    Category: MS Office    Views: 773

Is there a way to trigger conditional formatting from within VB? Maybe
that's not the right question, but here's what I'm trying to do:

Each row is a record containing an email address. On one sheet I have
parts of the record averaged, triggereing conditional cell shading
depending on the results. 1-2=yellow, 2-3=orange etc.

What I want to do is something like

If (average) from sheet 'tally' is from 1-2
then find the row containing that email address on sheet 'records'
apply the coloring to the row continaing that email address, depending
on what the original average was.

If this is too convoluted, feel free to tell me that I'm not explaining
it well enough.



2 Answers Found

Answer #1    Answered By: Allan Bailey     Answered On: Sep 16

The following snippet will set conditional  formatting in the selection
to show red if not equal to the value in D.

Selection.FormatConditions.Add _
Type:=xlCellValue, _
Operator:=xlNotEqual, _
Selection.FormatConditions(1).Font.ColorIndex = 3

This is taken almost directly from the macro recorder.

Answer #2    Answered By: Baylen Smith     Answered On: Sep 16

Perfect, and thanks for reminding me hwo you got it, I should have
been able to find  that myself

Didn't find what you were looking for? Find more on Conditional formatting? Or get search suggestion and latest updates.