Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Conditional Formatting and Text Alignment

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.FormatConditi ons.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

  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Conditional Formatting and Text Alignment

You could trigger the macro on the worksheet change event.
--
JNW


"Rick S." wrote:

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.FormatConditi ons.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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Conditional Formatting and Text Alignment

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



"JNW" wrote:

You could trigger the macro on the worksheet change event.
--
JNW


"Rick S." wrote:

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.FormatConditi ons.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

  #4   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Conditional Formatting and Text Alignment

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.
--
JNW


"Rick S." wrote:

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



"JNW" wrote:

You could trigger the macro on the worksheet change event.
--
JNW


"Rick S." wrote:

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.FormatConditi ons.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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional formatting in text box pankaj Excel Discussion (Misc queries) 0 November 1st 07 09:09 AM
Conditional Formatting to Change Cell Alignment? Sam Chambers[_2_] Excel Discussion (Misc queries) 3 June 11th 07 04:10 PM
Conditional Formatting based on text within a cell w/ text AND num Shirley Excel Worksheet Functions 2 December 22nd 06 01:40 AM
Formatting alignment - can I show text upside down? PhilinLondon Excel Discussion (Misc queries) 5 November 13th 06 03:24 PM
Conditional Formatting based on Text within Text George Lynch Excel Discussion (Misc queries) 3 May 5th 05 07:58 PM


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"