VBA CODE FRAMING ACCORDING TO CONDITIONS

Excelpromax123

Board Regular
Joined
Sep 2, 2021
Messages
172
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone. I need a VBA code to underline when the product code (column B) appears 2 times or more (like the image described below). thank you
1693726290469.png
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Conditional formatting will work for this...
Book1
ABC
1NONAMEQTY
21x110
32х220
43x330
54х440
64х550
74хб60
85х770
96х880
106х990
117х10100
128х11100
139х123
1410х135
1511x145
1611х156
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C16Expression=AND(COUNTIF($A$2:$A$16,$A2)>1,COUNTIF($A$2:$A2,$A2)=COUNTIF($A$2:$A$16,$A2))textNO
A2:C16Expression=AND(COUNTIF($A$2:$A$16,$A2)>1,COUNTIF($A$2:$A2,$A2)=1)textNO
A2:C16Expression=COUNTIF($A$2:$A$16,$A2)>1textNO

I prefer highlighted cells rather than the borders because you cannot always tell if it borders above or below when looking at the results. The sample data is small enough it is easy to tell;), think bigger.

Hope that helps,

Doug
 
Upvote 1
Solution
Conditional formatting will work for this...
Book1
ABC
1NONAMEQTY
21x110
32х220
43x330
54х440
64х550
74хб60
85х770
96х880
106х990
117х10100
128х11100
139х123
1410х135
1511x145
1611х156
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:C16Expression=AND(COUNTIF($A$2:$A$16,$A2)>1,COUNTIF($A$2:$A2,$A2)=COUNTIF($A$2:$A$16,$A2))textNO
A2:C16Expression=AND(COUNTIF($A$2:$A$16,$A2)>1,COUNTIF($A$2:$A2,$A2)=1)textNO
A2:C16Expression=COUNTIF($A$2:$A$16,$A2)>1textNO

I prefer highlighted cells rather than the borders because you cannot always tell if it borders above or below when looking at the results. The sample data is small enough it is easy to tell;), think bigger.

Hope that helps,

Doug
THank you
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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