Solved

Insert blank Rows above rows with bold cell entries

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

740 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