Conditionally fill color base on cell value in Column A with VBA

primala

New Member
Joined
May 31, 2012
Messages
39
Hi,

I need to apply fill color "green" for the entire row (from column A to G) only if a cell value in column A contains with "111200317" or it might be better if could refer to cell A1 (cell value in A1 is 111200317). How to do it with VBA?

Regards
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Can't you use Conditional Formatting with a formula like?

=$A1=111200317

I don't see the need for VBA.
 

primala

New Member
Joined
May 31, 2012
Messages
39
Dear Andrew Poulsom,

Thanks so much for your kind assistance. I am working in project closeout, do material reconciliation and in the end validate what's the charges in and out within account 111200317. All of the transactions is noted in a batch number, and for one account (111200317) could have more than 400 batch numbers it means 400 excel files that I have to exercise. From and to which account charges related to.

By the way, I've tried your suggestion with 3 records below :
A1 = 111200317
A3 = 111200317.251000.2341
A4 = 111000239
A5 = 111200317.251000
A6 = 111000239
A7 = 111200317

and the formula in Conditional Formatting is =A$1, and applied to A3:A10 but all fill color turn into Green. Is there any mistake I made?

Thanks in advance
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Just remove the $ sign from A$1. It fixes the row reference which I thought is what you wanted.
 

primala

New Member
Joined
May 31, 2012
Messages
39
Dear Andrew,

Thanks for your attention and solution. Problem solved. Again, thanks so much.

Regards
 

Watch MrExcel Video

Forum statistics

Threads
1,127,052
Messages
5,622,420
Members
415,895
Latest member
Akhilesh28

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
Top