change text color based on another group of cells

Guitarmageddon

Board Regular
Joined
Dec 22, 2014
Messages
159
Hello everyone,

Here is an example of my data after all the other steps of my source macro are done. Essentially, just putting sorts on "ship-to" and "GROUP" columns at the end. Since everything is sorted into group columns and then given some cell borders to be easy to visually notice, I wanted to add one more text format.

For every same number group which has more than one distinct buyer within it, Id like to just make that font a color/bolded. Can anyone assist?

For example:
1646311289457.png


In the above source data, we would apply some VBA and it would come out like this:
1646311348565.png


The other unique groups have only one buyer involved, but group 7901 has more than one, so we apply the format. This would need to be looped to the end of the sheet, which is dynamic. Column A could be used as a reference to go until its blank then stop. It would be a given this VBA would be used within the total macro and all the sort context would already be applied by the time this little piece of code is executed.
 

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.
I can tell you what I think the logic is based on my Access vba experience, but I'm quite the novice with Excel vba.

I think you will need to create an inner and outer loop. The outer loop would be from 2 (1st row with data) to the last row with data in the column of your choosing. I'd get the value of Group first, then do a count of that value in the column and pass that to a variable. In the inner loop, if that count is 1, exit the inner loop. The outer loop would then advance one row. Rinse and repeat. If the count is greater than 1, the inner loop would be from 1 to that count and would do the format that many times, using Offset. It would then exit the inner loop, go back to the outer loop and either repeat the process or exit because the outer loop would be done.
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,553
Members
449,038
Latest member
Guest1337

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