Excel VBA - Change cell color based on value
Solved/Closed
Related:
- Vba color cell based on value
- Vba set cell color - Best answers
- Vba change cell color - Best answers
- Based on the cell values in cells b77 ✓ - Excel Forum
- Vba case like - Guide
- Vba color index - Guide
- Based on the values in cells b77 ✓ - Excel Forum
- Notepad++ background color - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
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