Solved

Automating Insert Rows in Excel Table

Posted on 2012-04-12
2
181 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 33

Accepted Solution

by:
Norie earned 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now