View Single Post
 
Old 07-09-2014, 08:16 AM
EC37 EC37 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: May 2014
Location: Waltham, MA
Posts: 56
EC37 is on a distinguished road
Default Conditional Formatting problem

Hello again!

I'm working on another export and trying to get Conditional Formatting to work again- but seems to be getting hung up on the actual font formatting piece. More specifically:

Code:
org.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
At least that's where it errors out and has me 'Debug'- which leaves that line highlighted.

The section itself pertaining to the Conditional Formatting is:

Code:
cc = Range("A2").End(xlDown).Row
Set org = Range("B" & cc)
    org.FormatConditions.Add Type:=xlExpression, Formula1:="=IF(AND($I3>$S$1,$I3<$U$1),$I3,"""")"
    org.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
     With org.FormatConditions(1).Font
            .Strikethrough = False
            .Color = -16727809
            .TintAndShade = 0
     End With
org.FormatConditions(1).StopIfTrue = False
Also hoping someone can check how I have 'org' set up. I want to format all cells in column B (less B1, the header row). However, since not all cells are populated in column B (therefore End(xlDown) would only select up to a certain point) I have it referencing column A- since this column will always have contents. The program doesn't yell at the way I have it set up now- so I'm guessing it's OK! But just wanted to double check.

I have another export template that i have, where the conditional formatting is written the EXACT same way- so I don't understand why it is causing a problem here.

Any help is appreciated (still new to VBA)

Thanks
E
Reply With Quote