Help with the following code...from EntireRow to set width

B

bentod

I have this code to format the entire row a certain color depending on
the text in Column "I". However, I really just want it to go from
column "A" to column "J".

What would I substitute for ".EntireRow"?

'------------------------------------------
Sub ConditionalFormatter()

[I2].Activate
With Range([I2], [I65536].End(xlUp)).EntireRow
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""N"""
.FormatConditions(1).Interior.ColorIndex = 10
.FormatConditions(1).Font.ColorIndex = 2
.FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""X"""
.FormatConditions(2).Interior.ColorIndex = 19
.FormatConditions(2).Font.ColorIndex = 1
End With

End Sub
'------------------------------------------

Thanks, Todd
 
J

Jim Cone

Todd,

With Range([I2], [I65536].End(xlUp)).Offset(0, -8).Resize(, 10)

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"bentod"
wrote in message
I have this code to format the entire row a certain color depending on
the text in Column "I". However, I really just want it to go from
column "A" to column "J".
What would I substitute for ".EntireRow"?
'------------------------------------------
Sub ConditionalFormatter()

[I2].Activate
With Range([I2], [I65536].End(xlUp)).EntireRow
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""N"""
.FormatConditions(1).Interior.ColorIndex = 10
.FormatConditions(1).Font.ColorIndex = 2
.FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""X"""
.FormatConditions(2).Interior.ColorIndex = 19
.FormatConditions(2).Font.ColorIndex = 1
End With

End Sub
'------------------------------------------
Thanks, Todd
 
B

bentod

Todd,

   With Range([I2], [I65536].End(xlUp)).Offset(0, -8).Resize(, 10)

Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"bentod"
wrote in message
I have this code to format the entire row a certain color depending on
the text in Column "I".  However, I really just want it to go from
column "A" to column "J".
What would I substitute for ".EntireRow"?
'------------------------------------------
Sub ConditionalFormatter()

[I2].Activate
    With Range([I2], [I65536].End(xlUp)).EntireRow
        .FormatConditions.Delete
        .FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""N"""
        .FormatConditions(1).Interior.ColorIndex = 10
        .FormatConditions(1).Font.ColorIndex = 2
        .FormatConditions.Add Type:=xlExpression, Formula1:="=
$I2=""X"""
        .FormatConditions(2).Interior.ColorIndex = 19
        .FormatConditions(2).Font.ColorIndex = 1
    End With

End Sub
'------------------------------------------
Thanks, Todd

I think I see what you were going for: count back 8 to column "A",
then add columns up to "J".

However, it yeilded no noticeable results.

Todd
 

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

Top