how to make each cell with subtotal in it to be bold with vba

rharri1972

Board Regular
Joined
Nov 12, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
I have recorded a macro to subtotal my sheet of data.
I am using this as each change in Column E and adding subtotal to Column H.

this macro is the ending part in a larger script of code to complete a modified report.

is there anyway when using vba to make the subtotal BOLD so that it stands out?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
To make the whole column H bold use this code:
VBA Code:
Range("H:H").Font.Bold = True

Otherwise you need to be more specific.
 
Upvote 0
I did ask for the subtotal to be bold that happens to be in Column H at each change in Colum E
 
Upvote 0
maybe I can repost this way for it to make more since.... I have a macro to subtotal my sheet. This happens for every change in Column E and adds Subtotal to Column H.
The line that shows Column E's value total (PRODUCT ID TOTAL)(Whatever the PRODUCT ID is) is BOLD but the subtotal in Column H is not.

is there a vba code to look through Column E looking for partial "TOTAL"(not case sensitive) when found go to the right 3 columns (Column H) and make that value BOLD. Loop through or continue until column has completely been looked through?
 
Upvote 0

As when using the Excel feature SubTotal - whatever manually or via a VBA procedure - each total is automatically set to bold …​
 
Upvote 0
As when using the Excel feature SubTotal - whatever manually or via a VBA procedure - each total is automatically set to bold …​
That is not the case for me:

1636930084890.png


@rharri1972
If your original data in column H does not consist of formulas, try

VBA Code:
Columns("H").SpecialCells(xlFormulas).Font.Bold = True
 
Upvote 0
.. and if column H did already have formulas, try this instead

VBA Code:
With Range("E1", Range("E" & Rows.Count).End(xlUp))
  .AutoFilter Field:=1, Criteria1:="*Total"
  .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlVisible).EntireRow.Font.Bold = True
  .AutoFilter
End With
 
Upvote 0
I was confusing the word in column E and the numbers in column H …​
 
Upvote 0
That is not the case for me:

View attachment 51260

@rharri1972
If your original data in column H does not consist of formulas, try

VBA Code:
Columns("H").SpecialCells(xlFormulas).Font.Bold = True
Hey Peter...This worked exactly the way i needed it to. I also used this for Column L which gives me my surplus/deficit which is what tells me the qty to order. I have also used the following code in an attempt to highlight the cell in Column L ....

Columns("L").SpecialCells(xlFormulas).Color = vbYellow

However...this does not work. Again this will be in the same row as the "total" line.
Any help with making the cell Highlighted with yellow?
 
Upvote 0
I don't know what is in your column L but if the only cells with formulas are on the Sub Total rows then

Rich (BB code):
Columns("L").SpecialCells(xlFormulas).Interior.Color = vbYellow

Otherwise

VBA Code:
Intersect(Columns("H").SpecialCells(xlFormulas).EntireRow, Columns("L")).Interior.Color = vbYellow
 
Upvote 0
Solution

Forum statistics

Threads
1,215,181
Messages
6,123,513
Members
449,101
Latest member
mgro123

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