VBA check list?

sirspams

New Member
Joined
Sep 6, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
"Hi,

I am trying to write a script that will check specific columns and ensure it contains

two cells with *specific text A* AND two more cells with *specific text B* AND a cell with *specific text C* AND a cell with *specific text D*.

If all that is in the column, then set that columns cell 3 background colour grey, however if even one of the specific texts are missing then set that columns cell 3 background to red.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
This can be done with a single conditional formatting rule. Do you require VBA?

This example assumes the first column to format is column A. I do not understand what you mean by cell 3. Do you mean the cell in row 3?

Select row 3 of the columns you need to format.
Set the background color of row 3 to red, as a default.
Add a conditional formatting rule using a formula, applying grey formatting:

Excel Formula:
=AND(COUNTIF(A:A,"specific text A")=2, COUNTIF(A:A,"specific text B")=2, COUNTIF(A:A,"specific text C")=1, COUNTIF(A:A,"specific text D")=1)

If the first column to format is not column A, change A:A to the appropriate column.
 
Upvote 0
Hi 6StringJazzer

Thank you so much for the reply, some of this is helpful.
I was hoping for it in VBA as I have multiple colomns and multiple sheets to put this through.
I also feel being able to use interior.colorindex much nicer as in the long run it will involve multiple colours depending on many factors
And yes I do mean the 3rd cell down in each coloumn (coloumns C through AC)
With VBA code for this "basic" task I feel confident in modifying it to fit my specific needs.

(I say "basic" task but for myself it certainly isn't)

Cheers
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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