Conditional Formatting and Text Alignment

R

Rick S.

How can I set the text alignment based on the cell value in the same manner
as Conditional Formatting?

'======Conditional text formatting
Range("F10:F30").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""TPG#"""

Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.TintAndShade = 0
End With
'======

Its easy to do in an "IF" statement, but that only works when the macro is
played.

I need the cell to align left when "TPG" is found in the cell. Conditional
formatting doesn't allow for alignment like it does for text formatting.

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007
 
R

Rick S.

I was afraid of having to do just that. I have too many sheets and too many
workbooks and too little time. LOL
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007
 
J

JNW

If only we could use VBA to stop time...

If the command works for all worksheets in a workbook you could also use the
workbook change event (I think it exists)

If the command works for all workbooks you use, put it in your personal.xls
file.
 

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