0

I'm trying to use the .style function in this formatting, but vba doesn't want to use it. Am I just using the .style wrong or do I need to use a different method to color the cells?

'Conditional Formatting
.FormatConditions.Delete
.FormatConditions.Add xlErrorsCondition, Formula1:= _
    "=IF(" & Cells(SelectedGroup, AreaSelected(2)).Offset(2, 1) & "=""Not Used"",TRUE, _ 
    FALSE)"
.FormatConditions(1).Style = "Bad"

.FormatConditions.Add xlErrorsCondition, Formula1:= _ 
    "=IF(" & Cells(SelectedGroup, AreaSelected(2)).Offset(2, 1) & "=""Used"",TRUE,FALSE)"
.FormatConditions(1).Style = "Good"
1

1 Answer 1

1

Style is a property of the Range object. In order to use it, you need to end your With statement and apply the style to the Range itself.

https://msdn.microsoft.com/en-us/vba/excel-vba/articles/range-style-property-excel

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.