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