View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default For next conditional

You had the cart before the horse:

Sub Conditional()
Dim sht As Worksheet

For Each sht In ActiveWorkbook.Sheets
With sht.Range("C7:C55")

.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="0"
.FormatConditions(1).Font.ColorIndex = 3
End With
Next sht
End Sub


"Faboboren" wrote:

Hi

I have this code, and is not running properly. I want a conditional format
for numbers less than 0 to become in red. any idea, thanks?


Sub Conditional()
Dim sht As Worksheet

For Each sht In ActiveWorkbook.Sheets
With sht.Range("C7:C55")
.FormatConditions(1).Font.ColorIndex = 3
.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="0"
End With
Next sht
End Sub