Find word in column, bold row & insert rows below

Winnietp

New Member
Joined
Jul 2, 2011
Messages
8
Hi, I’m trying to finish my first macro and I’m down to one last glitch. Please help!

I’m working with Excel 2003 and I need a macro that can find the word “Bottomline” whenever it appears in column A, bold that entire row and then insert two empty rows below it. The word will not always be in the same location.

Here’s an example of what I have…

Program
dlfjaldsjfldjf
dfadf
efadfa
afeaf
BOTTOMLINE
efadfa
fdfasdf
fdfafadsf
BOTTOMLINE
jfladjlfja
eardaf
BOTTOMLINE

...and this is what I want.

Program
dlfjaldsjfldjf
dfadf
efadfa
afeaf
BOTTOMLINE


efadfa
fdfasdf
fdfafadsf
BOTTOMLINE


jfladjlfja
eardaf
BOTTOMLINE

Thanks for your help.

Shari
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
Sub BoldBottomLine()
Application.ScreenUpdating = False
Dim xRow&
For xRow = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(xRow, 1).Value = "BOTTOMLINE" Then
Rows(xRow).Font.Bold = True
Rows(xRow + 1).Resize(2).Rows.Insert
End If
Next xRow
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Give this macro a try (it should be pretty quick)...
Code:
Sub BOTTOMLINE()
  Dim A As Range
  Application.ScreenUpdating = False
  With Columns("A")
    .Replace "BOTTOMLINE", "=BOTTOMLINE", xlWhole
    With .SpecialCells(xlCellTypeFormulas)
      .Value = "BOTTOMLINE"
      .EntireRow.Font.Bold = True
      For Each A In .Areas
        A.Offset(1).Resize(2).EntireRow.Insert
      Next
    End With
  End With
  Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Hi Guys,

I'm happy to say that both codes worked and I can finally finish my first-ever (with lots of help) macro.

Thanks so much.

Shari
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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