Conditional Formatting VB
Closed
nicola1987
Posts
1
Registration date
Wednesday 24 April 2013
Status
Member
Last seen
24 April 2013
-
24 Apr 2013 à 06:19
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 7 May 2013 à 11:15
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 7 May 2013 à 11:15
Related:
- Conditional Formatting VB
- Excel clear formatting - Guide
- Excel conditional formatting based on date - Guide
- Vb editor - Download - IDE
- Risk formatting excel - Excel Forum
- Vb net round - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
27 Apr 2013 à 10:26
27 Apr 2013 à 10:26
I tired with this formula in cell b17
=IF("a"="a","DR",4)
and i did not get any error. If you can explain how you are able to replicate the issue, one can see what one can do
=IF("a"="a","DR",4)
and i did not get any error. If you can explain how you are able to replicate the issue, one can see what one can do
29 Apr 2013 à 10:25
I tried to solve this one but couldn't figure out an answer myself. I thought Worksheet_Calculate would be the answer. But how do you refer to the recalculated cell? I don't know.
To recreate the issue:
B17: =IF(A17="a","DR",4)
A17: a
Curious to see how you would solve this query.
Best regards,
Trowa
2 May 2013 à 08:17
1. on cell change, loop thru each and see if color needs to be updated (thats do able for sure)
2. instead of =if(...), have a custom function to do that and have formula marked as volatile (need to see at what cost)
3. have in some hidden location cells that has a custom function marked as volatile. have those formula apply condition (need to see at what cost)
7 May 2013 à 11:15
Maybe when you have the time you can write a custom function for us (me).
In the meantime here is a working code for Nicola:
Private Sub Worksheet_Change(ByVal Target As Range) Dim cell As Range Application.ScreenUpdating = False For Each cell In Range("b15:bm182") If cell.Value = vbNullString Then cell.Interior.ColorIndex = 0 cell.Font.ColorIndex = 1 cell.Font.Bold = False ElseIf cell.Value = "O" Then cell.Interior.ColorIndex = 4 cell.Font.ColorIndex = 4 cell.Font.Bold = True ElseIf cell.Value = "W" Then cell.Interior.ColorIndex = 37 cell.Font.ColorIndex = 37 cell.Font.Bold = True ElseIf cell.Value = "I" Then cell.Interior.ColorIndex = 41 cell.Font.ColorIndex = 41 cell.Font.Bold = True ElseIf cell.Value = "DR" Then cell.Interior.ColorIndex = 15 cell.Font.ColorIndex = 15 cell.Font.Bold = True ElseIf cell.Value = "C" Then cell.Interior.ColorIndex = 38 cell.Font.ColorIndex = 38 cell.Font.Bold = True ElseIf cell.Value = "R" Then cell.Interior.ColorIndex = 45 cell.Font.ColorIndex = 45 cell.Font.Bold = True ElseIf cell.Value = "DM" Then cell.Interior.ColorIndex = 27 cell.Font.ColorIndex = 27 cell.Font.Bold = True ElseIf cell.Value = "D" Then cell.Interior.ColorIndex = 15 cell.Font.ColorIndex = 15 cell.Font.Bold = True End If Next cell Application.ScreenUpdating = True End Sub