Highlighting a bolded cell

rsiluch

New Member
Joined
Jun 2, 2016
Messages
4
Just started using VBA, so I know next to nothing. Most likely a very basic question here. What I am trying to do on my spreadsheet is highlight every cell that contains bolded font, from G2 to AU12.

This is going to be a running spreadsheet, so my first question is: is that possible to achieve automatically. The way it's set up so far is that the highest value in the column (from rows 2-12 for this table) gets bolded, and I would like it to be highlighted as well. If I changed the numbers around in the input sections, and thusly my results columns change which numbers are the highest in each one, changing which numbers are bolded, can I mimic that change with those cells being highlighted as well?

If not, what would you suggest me to do?


(P.S. Thanks for your patience with such a beginner here)
 
Welcome to the forum.

How are you bolding the font now? If it's via VBA, like this:

Selection.Font.Bold = True

then you can highlight the cell at the same time in a similar way:

Selection.Interior.ColorIndex = 3

where the 3 can range from 0 (no shading) to 56, where those are Excel's default colors. You can go beyond those colors if you want, but we'll start with the basics.

But you don't need VBA at all for this. You can use Conditional Formatting.

1) Select G2:AU12
2) From the Home tab, click Conditional Formatting > New Rule > Use a formula > and enter
=AND(G2=MAX(G$2:G$12),G2<>"")
3) Click the Format button, and from the Font tab select Bold, and from the Fill tab, pick a color.
4) Click OK.

That will dynamically apply your formatting without the need for VBA.
 
Upvote 0
Welcome to the forum.

How are you bolding the font now? If it's via VBA, like this:

Selection.Font.Bold = True

then you can highlight the cell at the same time in a similar way:

Selection.Interior.ColorIndex = 3

where the 3 can range from 0 (no shading) to 56, where those are Excel's default colors. You can go beyond those colors if you want, but we'll start with the basics.

But you don't need VBA at all for this. You can use Conditional Formatting.

1) Select G2:AU12
2) From the Home tab, click Conditional Formatting > New Rule > Use a formula > and enter
=AND(G2=MAX(G$2:G$12),G2<>"")
3) Click the Format button, and from the Font tab select Bold, and from the Fill tab, pick a color.
4) Click OK.

That will dynamically apply your formatting without the need for VBA.

Thank you very much!!!

I now realize that I definitely knew how to do that, but had mentally put myself in a corner and couldn't see the light. I also definitely appreciate the VBA help, as I think I will try to convert it over to the VBA track eventually.

Much appreciate the help, you just saved me a lot of time
 
Upvote 0

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