Bold Entire Row

spyldbrat

Board Regular
Joined
May 5, 2002
Messages
211
Office Version
  1. 365
My spreadsheet is from Col A to Col O

Some rows in Col C contain a number followed by the word Total (1234 Total).

I want to bold the entire row for all that that contain the word Total. Below is macro I am using -- can someone tell me what I doing wrong?

For i = 1 To Cells(Rows.Count, 3).End(xlUp).Row
If Cells(i, 3) = "%Total%" Then
Rows(i).EntireRow.Font.Bold = True
End If
Next
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try
Code:
If Cells(i, 3) like "*Total*" Then
 
Upvote 0
Not sure what %Total% does

I would use InStr with a case check


Code:
If InStr(LCase(Cells(i, 3)), "total") > 0 Then
 
Upvote 0
I would use InStr with a case check
Code:
If InStr(LCase(Cells(i, 3)), "total") > 0 Then
You don't need the LCase function call as InStr has the "case check" ability built-in to itself...

If InStr(1, Cells(i, 3), "Total", vbTextCompare) > 0 Then

Note: When you use the vbTextCompare argument, it does not matter what letter casing you use for the word being searched for.
 
Last edited:
Upvote 0
Hey Rick,

I didn't realise that!
Thanks.
I'll probably forget it in a week or two though....
 
Upvote 0

Forum statistics

Threads
1,215,278
Messages
6,124,023
Members
449,139
Latest member
sramesh1024

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