Solved

Insert blank Rows above rows with bold cell entries

Posted on 2012-03-28
3
304 Views
Last Modified: 2012-03-29
Dear Experts:

I wonder whether the following is feasible using VBA:

I got a table with 7 columns and lots of rows

Some of the rows have bold cell entries.

I would like to run a macro that performs the following actions:

The macro is to look for rows with bold entries and insert 4 blank rows above all the rows that contain bold entries.

I have attached a sample file for your convenience.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Inserting-Rows-Before-Rows-Conta.xlsx
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
kgerb earned 500 total points
ID: 37778120
Try this.  I think it will do what you want.
Sub AddRowsBeforeBoldEntries()
Dim i As Long, StartRow As Long
StartRow = 4
For i = Cells(Rows.Count, "B").End(xlUp).Row To StartRow Step -1
    With Cells(i, "B")
        If .Value <> "" And .Font.Bold = True Then .Resize(4).EntireRow.Insert
    End With
Next i
End Sub

Open in new window

Kyle
0
 

Author Closing Comment

by:AndreasHermle
ID: 37779212
Kyle,

great stuff! Works like a charm.

I am really glad to have the chance to turn to real professionals when it comes to VBA coding.

Thank you very much.

Regards, Andreas
0
 
LVL 12

Expert Comment

by:kgerb
ID: 37781526
You're welcome.  Glad I can help.
Kyle
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question