Changing Interior Colors on Text box using VBA code.

Dheepak

Board Regular
Joined
Aug 25, 2013
Messages
64
Hi All,

Need help on changing interior colors on text box using VBA Code. I have wrote the below code for the cell (4,7) which displays the sum of the data in cell (4,3), cell (4,4), cell (4,5) and cell (4,6).

Sub color()

If Cells(4, 7) > 50 Then

Cells(4, 7).Interior.color = RGB(255, 0, 0)

Else

Cells(4, 7).Interior.color = RGB(0, 255, 0)

End If

End Sub


However, the above code works only when i run it manually. But, i need the cell(4,7) interior color to change automatically at the time of entering the values on cells (4,3), cell (4,4), cell (4,5) and cell (4,6) or once i entered all the values in the cells (4,3), cell (4,4), cell (4,5) and cell (4,6).

Note: Cell (4,7) is already updated with the formula =C4+D4+E4+F4

Can someone help on this :confused:

Regards,
Dheepak
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,214,926
Messages
6,122,305
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top