Find 2 in a column and make it bold

donlincolnmre2

Board Regular
Joined
Dec 23, 2006
Messages
142
Hello

I'm looking for a macro that will search column L in a sheet for number 2 and if it finds it then make that 2 bold, red and 18 point.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Give this macro a try...
Code:
Sub Make2BoldRed18Point()
  Application.ReplaceFormat.Clear
  With Application.ReplaceFormat.Font
    .Size = 18
    .Bold = True
    .Color = vbRed
  End With
  Columns("L").Replace 2, "", xlWhole, , , , False, True
  Application.ReplaceFormat.Clear
End Sub
 
Upvote 0
Hello Rick

The macro stopped on the following line, i'm using Excel 2000, if that make a difference.

Application.ReplaceFormat.Clear
 
Upvote 0
I got an email, but there was no text, like i mentioned i'm using Excel 2000, so i don't know why the macro is aborting at " Application.ReplaceFormat.Clear "
 
Upvote 0
I got an email, but there was no text, like i mentioned i'm using Excel 2000, so i don't know why the macro is aborting at " Application.ReplaceFormat.Clear "

It is because your version of Excel is nearly 20 years old and that functionality does not exist in your version of Excel. Let me try to develop a some code for you that should work on your version of Excel. By the way, for future questions you may ask, you should always mention that you are using XL2000 so we will know that we cannot use some of the "newer" functionality that Excel added over the years. In case you are interested, I am using XL2010 which, while oldish, is when Excel added significant functionality and removed a lot of troublesome limitations.
 
Upvote 0
Okay that would be great.

Give this macro a try...
Code:
Sub Make2BoldRed18Point()
  Dim Cell As Range
  For Each Cell In Range("L1", Cells(Rows.Count, "L").End(xlUp))
    If Cell.Value = 2 Then
      With Cell.Font
        .Size = 18
        .Bold = True
        .Color = vbRed
      End With
    End If
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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