LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 4 conditional formats

after having recorded a macro containing 3 conditional formats, i retrieve
the following code in VBA Editor :

Range("C24:AF54,C60:AF90,C96:AF126").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="1"
Selection.FormatConditions(1).Font.ColorIndex = 11
Selection.FormatConditions(1).Interior.ColorIndex = 11
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="0,5"
Selection.FormatConditions(2).Font.ColorIndex = 41
Selection.FormatConditions(2).Interior.ColorIndex = 41
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="-0,5"
Selection.FormatConditions(3).Font.ColorIndex = 15
Selection.FormatConditions(3).Interior.ColorIndex = 15
Sheets("Test2").Select

after the "Selection.FormatConditions(3).Interior.ColorI ndex = 15" line, i
try adding a fourth conditional format in VBA as follows:

Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="-1"
Selection.FormatConditions(4).Font.ColorIndex = 20
Selection.FormatConditions(4).Interior.ColorIndex = 20

However, when i run the macro, an error is returned at the
" Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="-1" " line

is it possible to add a fourth (fifth,..) conditional format ?

thanks
andy
 
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 Formats, how to scroll and view all formats? Bill E Excel Worksheet Functions 0 May 12th 10 07:58 PM
Conditional formats- paste special formats? jcarney Excel Discussion (Misc queries) 1 November 1st 07 06:37 PM
paste conditional formats as formats leo Excel Discussion (Misc queries) 2 July 5th 07 10:06 AM
How do I add more Conditional Formats? Saint Excel Discussion (Misc queries) 2 April 26th 05 07:30 PM
Any way to have more than three conditional formats? Bill Brehm Excel Worksheet Functions 1 December 7th 04 09:37 AM


All times are GMT +1. The time now is 12:12 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"