Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can someone help with this macro?
I'm trying to apply conditioning formatting to different ranges, but when I
run the macro, it only applies it to the last range. I hope it makes sense Sub subtotal() ' ' subtotal Conditional ' ' Range("G9").Select Cells.FormatConditions.Delete Range("G9:G200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=F9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("L9").Select Cells.FormatConditions.Delete Range("L9:L200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=K9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("Q9").Select Cells.FormatConditions.Delete Range("q9:q200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=P9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("V9").Select Cells.FormatConditions.Delete Range("v9:v200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=U9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AA9").Select Cells.FormatConditions.Delete Range("AA9:AA200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=Z9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AF9").Select Cells.FormatConditions.Delete Range("AF9:AF200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AE9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True ActiveSheet.Outline.ShowLevels RowLevels:=2 Range("B2").Select End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can someone help with this macro?
Just remove
Cells.FormatConditions.Delete everywhere it occurs... "Gilbert" wrote: I'm trying to apply conditioning formatting to different ranges, but when I run the macro, it only applies it to the last range. I hope it makes sense Sub subtotal() ' ' subtotal Conditional ' ' Range("G9").Select Cells.FormatConditions.Delete Range("G9:G200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=F9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("L9").Select Cells.FormatConditions.Delete Range("L9:L200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=K9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("Q9").Select Cells.FormatConditions.Delete Range("q9:q200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=P9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("V9").Select Cells.FormatConditions.Delete Range("v9:v200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=U9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AA9").Select Cells.FormatConditions.Delete Range("AA9:AA200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=Z9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AF9").Select Cells.FormatConditions.Delete Range("AF9:AF200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AE9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True ActiveSheet.Outline.ShowLevels RowLevels:=2 Range("B2").Select End Sub |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can someone help with this macro?
Very nice Sheeloo. It worked great. Thanks for your help.
"Sheeloo" wrote: Just remove Cells.FormatConditions.Delete everywhere it occurs... "Gilbert" wrote: I'm trying to apply conditioning formatting to different ranges, but when I run the macro, it only applies it to the last range. I hope it makes sense Sub subtotal() ' ' subtotal Conditional ' ' Range("G9").Select Cells.FormatConditions.Delete Range("G9:G200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=F9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("L9").Select Cells.FormatConditions.Delete Range("L9:L200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=K9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("Q9").Select Cells.FormatConditions.Delete Range("q9:q200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=P9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("V9").Select Cells.FormatConditions.Delete Range("v9:v200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=U9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AA9").Select Cells.FormatConditions.Delete Range("AA9:AA200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=Z9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True Range("AF9").Select Cells.FormatConditions.Delete Range("AF9:AF200").Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AE9=1" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16776961 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = True ActiveSheet.Outline.ShowLevels RowLevels:=2 Range("B2").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |