Explain the options for the FormatConditions and StopIfTrue in Custom Formatting for a selected range

Rx_

Board Regular
Joined
May 24, 2011
Messages
52
Explain any options for the statement: FormatConditions(1).StopIfTrue = False
The code works as intended. I just don't understand the values.
Just wish to understand why it is always a (1) and = False in the examples.
Also, want to know if there are any additional opportunities to have other options.

In Microsoft Access linked to SQL Server and Oracle, I use vba to create highly customized Excel reports (remote automation).
The objXL is just a reference to the Excel Application. The recordset object provides the number of columns and row count.

Code:
' intRowPos is 5 - the data starts at row 5 to allow for a title bar    
objxl.DisplayAlerts = False     ' Turn off Display Alerts   
 objxl.Worksheets(intWorksheetNum).Cells(intRowPos, 1).CopyFromRecordset rsDataRE_Seg1Rule     intMaxheaderColCount = rsDataRE_Seg1Rule.Fields.Count - 1     ' use recordset object to capture intMaxRecordCount. IntRowPos is a rownumber where the data begins.  
  objxl.Range(Cells(intRowPos, 1), Cells(intMaxRecordCount + (intRowPos), intMaxheaderColCount + 1)).Select    ' SPECIAL SECTION turns True Green and False to RED - using SELECTION     
objxl.Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _        
   Formula1:="=FALSE"    
objxl.Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority    
With objxl.Selection.FormatConditions(1).Font        
   .Color = -16383844    
End With    
With objxl.Selection.FormatConditions(1).Interior        
   .PatternColorIndex = xlAutomatic        
   .Color = 13551615    
End With    
objxl.Selection.FormatConditions(1).StopIfTrue = False    
objxl.Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _        
Formula1:="=TRUE"    
objxl.Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority    
With objxl.Selection.FormatConditions(1).Font        
   .Color = -16752384    
End With    
With objxl.Selection.FormatConditions(1).Interior        
   .PatternColorIndex = xlAutomatic        
   .Color = 13561798    
End With    
objxl.Selection.FormatConditions(1).StopIfTrue = False
Also posted at the Access site: Excel - CopyFromRecordset - Set Rules for values - Access World Forums
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi,

You can apply more than one lot of Conditional Formatting to a range.

For instance, you could have one that highlights the top 10 values in red and another that highhlights the numbers over 20 in amber.

The "stop if true" option means stop applying the conditional formatting if one is true. This is a good example of how it can be used: Using Stop If True when Conditional Formatting » Bacon Bits
 
Upvote 0
That is a great answer! I searched and could not find that anywhere.
I worried when my script kept saying "stop if true".
Now, this allows to customize my scripting so one condition can trump another.

Thanks so much.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top