Excel VBA - Change cell color based on value
Solved/Closed
Related:
- Excel vba change cell color based on value
- Excel vba color cell based on value - Best answers
- Vba color cell based on value - Best answers
- Number to words in excel without vba - Guide
- How to change account based in instagram - Instagram Forum
- Notepad++ change background color - Guide
- Based on the values in cells b77:b81, what function can automatically return the value in cell c77? ✓ - Excel Forum
- How to enable vba in excel - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
549
Updated on Nov 30, 2018 at 03:48 PM
Updated on Nov 30, 2018 at 03:48 PM
Hi Tandar,
I'm a little confused comparing your story with your code.
Try this code and see if it yields the desired result:
Best regards,
Trowa
I'm a little confused comparing your story with your code.
Try this code and see if it yields the desired result:
Sub ChangeColor() lRow = Range("C" & Rows.Count).End(xlUp).Row Set MR = Range("C2:C" & lRow) For Each cell In MR If cell.Value = "Yes" Then cell.Interior.ColorIndex = 10 If cell.Value = "No" Then cell.Interior.ColorIndex = 3 Next End Sub
Best regards,
Trowa
Jun 23, 2011 at 04:02 PM
Thanks
Jul 3, 2011 at 08:16 AM
If cell.Value = "Yes" Then cell.Interior.ColorIndex = 10
If cell.Value = "No" Then cell.Interior.ColorIndex = 3
to some thing like this