Solved

Insert blank Rows above rows with bold cell entries

Posted on 2012-03-28
3
305 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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.

726 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