Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Automating Insert Rows in Excel Table

Posted on 2012-04-12
2
Medium Priority
?
187 Views
Last Modified: 2012-04-12
I have an excel spreadsheet which refreshes its data from another source

I need to insert a blank row where the value in Column B changes

I have attached before and after sheets as examples

Thanks
Paul
937-9-before.xlsm
937-9-After.xlsm
0
Comment
Question by:Zarbs
2 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 2000 total points
ID: 37840625
Try this.
Dim ws As Worksheet
Dim I As Long

    Set ws = Worksheets("937-9 Daily Planned Transfers")
    
    For I = ws.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    
        If ws.Range("B" & I) <> ws.Range("B" & I - 1) Then
            ws.Range("B" & I).EntireRow.Insert
        End If
    Next I

Open in new window

0
 

Author Closing Comment

by:Zarbs
ID: 37840643
Awesome .... works a dream

Thanks very much
Paul
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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.

877 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