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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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