VBA Mark row with yellow matching criteria

jakobt

Active Member
Joined
May 31, 2010
Messages
337
Want to colour all rows in sheet 1 yellow, which match the following criteria:

The cell in column B should be included in Column F in Sheet 2.

Column B in sheet 1 contains the account for the line item. While Column F in sheet 2 match specific account.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Select column B on Sheet1, and enter the following Conditional Formatting formula:
Code:
=COUNTIF(Sheet2!F:F,B1)>0
and choose the yellow formatting color.
 
Upvote 0
Thanks great idea.

I would prefer a VBA for each code, as I need to built several further actions on at a later stage all built into one macro.
 
Upvote 0
You can do that with VBA.
Simply turn on the Macro Recorder and record yourself performing the steps in my previous post manually, and you will have the VBA code you need to do that.
 
Upvote 0
No cannot.
Should have a code like for each cell in column A;
Criteria matching cell in column in cell F, Sheet2.
Mark row with yellow
Next.
End sub


This was the format I was thinking off...
 
Last edited:
Upvote 0
No cannot.
Should have a code like for each cell in column A;
Criteria matching cell in column in cell F, Sheet2.
Mark row with yellow
Next.
End sub


This was the format I was thinking off...
Can you explain why that will not work?
I need to make sure I understand your needs, because different methods have different implications.

For example, Conditional Formatting is dynamic, which means once it is set up, it happens automatically and any changes are reflected IMMEDIATELY!
There are two different VBA methods to do something what you are talking about:
- One is to use automated VBA code that runs automatically as someone manually updates the cells (the disadvantage here is that is that it does not run on already existing data, just newly entered data)
- The other is VBA to be run manually whenever you want (the disadvantage is that it is not automated)
 
Upvote 0

Forum statistics

Threads
1,214,617
Messages
6,120,541
Members
448,970
Latest member
kennimack

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