简体   繁体   中英

VBA: Highlight a row with a specific column value

I am working on a very large excel 2010 workbook with several sheets.

One of the sheets is called "RatePlan" and one of the columns in this sheet is "RatePlanCde" .

Some of these "RatePlanCde" (a total of 2514) are not valid anymore and have been highlighted in Red.

I need to find if "RatePlanCde" column exists in any other sheets. If so, then highlight the row with the invalid "RatePlanCde" value in all the sheets in Red too.

Can this be done using a VBA script and how?

Formula for conditional formatting is a simple VLookup

The following formula assumes that the codes in the "other" sheets is in Col A, the codes are in the Rateplan-Sheet in Col C and the "INVALID"-marker in COl D:

=VLOOKUP(A2;RatePlan!$C$2:$D2515;2;FALSE)="INVALID"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM