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

I have wrote a VBA code to add conditional formatting to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default conditional formatting

Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default conditional formatting

It isn't that my formula doesn't work, it is that the
conditional formatting just doesn't save???

-----Original Message-----
Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting

to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex =

xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default conditional formatting

Hi
what do you mean with 'does not save'?

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree23 wrote:
It isn't that my formula doesn't work, it is that the
conditional formatting just doesn't save???

-----Original Message-----
Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default conditional formatting

When I click on the sheet, then click on the cell, then
check the conditional formatting, it isn't there.


-----Original Message-----
Hi
what do you mean with 'does not save'?

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree23 wrote:
It isn't that my formula doesn't work, it is that the
conditional formatting just doesn't save???

-----Original Message-----
Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex =

xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting

to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex =

xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???
.

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default conditional formatting

Hi
this works for me (so I can see this condition within the dialog). Have
you tried this code as 'stand-alone'

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree23 wrote:
When I click on the sheet, then click on the cell, then
check the conditional formatting, it isn't there.


-----Original Message-----
Hi
what do you mean with 'does not save'?

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree23 wrote:
It isn't that my formula doesn't work, it is that the
conditional formatting just doesn't save???

-----Original Message-----
Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:= _
"=(AD10<895)*(AD10<0)"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


scrabtree wrote:
I have wrote a VBA code to add conditional formatting to a
cell. Here is the code:

With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:= _
"=IF(AD10=895,0,IF(AD10=0,0,1))"
.FormatConditions(1).Font.ColorIndex = xlAutomatic
.FormatConditions(1).Interior.ColorIndex = 3

However...it isn't adding the formatting???
.

.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default conditional formatting

Did you select cell AD10 of sheet 'T.S.' before you looked at conditional formatting
because that is the only cell that the C.F. is applied to in the macro...
---
"scrabtree23" wrote in ...
When I click on the sheet, then click on the cell, then
check the conditional formatting, it isn't there.

scrabtree23 wrote:
It isn't that my formula doesn't work, it is that the
conditional formatting just doesn't save???

-----Original Message-----
Hi
the following works for me:
Sub foo()
With Sheets("T.S.").Range("AD10")
.FormatConditions.Delete



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 formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Formatting Conditional Formatting Icon Sets The Rook[_2_] Excel Discussion (Misc queries) 3 March 7th 09 08:48 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 11:12 AM.

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"