Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default For next conditional

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default For next conditional

JLGWhiz,

Great, is working, thanks

"JLGWhiz" wrote:

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

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
Conditional Format overwrighting previous conditional format davethewelder Excel Programming 2 April 10th 08 04:01 PM
Conditional Rank (or rather, Conditional Range) [email protected] Excel Worksheet Functions 6 April 16th 07 06:15 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM
Multiple conditional on conditional format formula Frank Kabel Excel Programming 1 July 27th 04 06:24 PM
Multiple conditional on conditional format formula Bob Phillips[_7_] Excel Programming 0 July 27th 04 05:30 PM


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