VBA Changing interior color based on value of another cell in same row

sunilkaru

New Member
Joined
Oct 22, 2019
Messages
1
Dear All

i have a data base and i need to change back ground color of a cell based on value of another cell in the same row. for an example, how to change color of A1 , if C1 got a date value (only type of value)? other types are email and blank. so I need to change 3 different colors?

[TABLE="width: 254"]
<colgroup><col span="2"><col></colgroup><tbody>[TR]
[TD="align: center"]A1[/TD]
[TD="align: center"]B1[/TD]
[TD="align: center"]C1[/TD]
[/TR]
[TR]
[TD="align: center"]PO20054[/TD]
[TD="align: center"]G020735[/TD]
[TD="align: center"]21-Oct-19[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Welcome to the MrExcel board!

Do you really need VBA? Could you just use Conditional formatting like this?

Excel Workbook
ABC
1PO20054G02073521-Oct-19
2PO20055G020736
3PO20056G020737abc@def.com
4PO20057G02073824-Oct-19
CF Date Blank Email
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A11. / Formula is =FIND("@",C1)Abc
A12. / Formula is =C1=""Abc
A13. / Formula is =AND(C1<>"",ISERROR(FIND("@",C1)))Abc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,944
Members
452,539
Latest member
delvey

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