LearnVBA83
Board Regular
- Joined
- Dec 1, 2016
- Messages
- 113
- Office Version
- 365
- Platform
- Windows
Hi team,
I have a macro with a check figure at the end. I want to write it so that if the cell = 0 then fill the cell in great. If not then fill the cell in Red. Is that possible? the below code isn't working. I'm getting run-time error '424' Object required.
I have a macro with a check figure at the end. I want to write it so that if the cell = 0 then fill the cell in great. If not then fill the cell in Red. Is that possible? the below code isn't working. I'm getting run-time error '424' Object required.
VBA Code:
'Fill Cell Color
If ActiveSheet.Range("G1") = 0 Then
ActiveSheet.Range("G1").Interior.Color.vbGreen
Else
ActiveSheet.Range("G1").Interior.Color.vbRed
End If