Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Range Selection help (Formatting)

I select a range in a row and begin formatting per the code below, I am
having trouble getting this code to work.
It will find the first cell with "TRG" but none of the others? It appears
to complete the Font changes but not the alignment changes (less the first
cell with "TRG").
'======
Range("F10:F29").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""TRG#"""

Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.TintAndShade = 0
End With
With Selection
If Left(ActiveCell.Value, 3) = "TRG" Then
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
End If
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("D10").Select
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Range Selection help (Formatting)

I think I see what is wrong, I am stepping thru each cell?
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"Rick S." wrote:

I select a range in a row and begin formatting per the code below, I am
having trouble getting this code to work.
It will find the first cell with "TRG" but none of the others? It appears
to complete the Font changes but not the alignment changes (less the first
cell with "TRG").
'======
Range("F10:F29").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""TRG#"""

Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.TintAndShade = 0
End With
With Selection
If Left(ActiveCell.Value, 3) = "TRG" Then
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
End If
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("D10").Select
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Range Selection help (Formatting)

Last reply was NOT stepping thru each cell.
I believe am now.
'======
Range("F10:F29").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""TRG#"""

Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.TintAndShade = 0
End With
For Each c In Selection
If Left(c.Value, 3) = "TRG" Then
c.HorizontalAlignment = xlGeneral
c.VerticalAlignment = xlBottom
End If
Next c
Selection.FormatConditions(1).StopIfTrue = False
Range("D10").Select
'======
So much to learn!
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"Rick S." wrote:

I think I see what is wrong, I am stepping thru each cell?
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"Rick S." wrote:

I select a range in a row and begin formatting per the code below, I am
having trouble getting this code to work.
It will find the first cell with "TRG" but none of the others? It appears
to complete the Font changes but not the alignment changes (less the first
cell with "TRG").
'======
Range("F10:F29").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""TRG#"""

Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = True
.TintAndShade = 0
End With
With Selection
If Left(ActiveCell.Value, 3) = "TRG" Then
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
End If
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("D10").Select
'======
--
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
Narrow Range based on Selection in Another Range David Excel Discussion (Misc queries) 3 July 1st 07 05:12 PM
Range(Selection, Selection.End(xlToRight)).Select Dave Birley Excel Programming 2 June 6th 07 04:53 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
getting rid of selection for formatting Arnold Klapheck Excel Programming 1 September 26th 06 07:31 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM


All times are GMT +1. The time now is 12:18 PM.

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

About Us

"It's about Microsoft Excel"