text formatting help

Blauv

Board Regular
Joined
Mar 26, 2010
Messages
126
Code:
Sub AddFormCond()





         With Range("A2:I2").FormatConditions.Add( _
        Type:=xlExpression, _
        Formula1:="=$A2=""SAP""")
    
        .Interior.Color = RGB(255, 128, 0)
        .Font.Color = RGB(0, 0, 0)
        .StopIfTrue = False
        .Font.Bold = True
        
    End With
    
        With Range("A2:I2").FormatConditions.Add( _
        Type:=xlExpression, _
        Formula1:="=$A2=""RP""")
    
        .Interior.Color = RGB(0, 102, 204)
        .Font.Color = RGB(0, 0, 0)
        .StopIfTrue = False
        .Font.Bold = True
    End With
    








End Sub

I am using the above code to add some conditional format to cells.
I would like the Text centered but nothing I try centers the Text.

Any help here is appreciated.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I have just double-checked and cannot find anywhere in CF that will align cells. Maybe just use regular formatting instead?
 
Upvote 0
doesnt work the CF overrides it and sets one cell left, one right, one left, back and forth.
 
Upvote 0
I don't see that CF would be doing that, because you cannot use CF to do that. Maybe you have something else running in the background?
 
Upvote 0

Forum statistics

Threads
1,223,155
Messages
6,170,403
Members
452,325
Latest member
BlahQz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top