Solved

Automating Insert Rows in Excel Table

Posted on 2012-04-12
2
179 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
Comment Utility
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
Comment Utility
Awesome .... works a dream

Thanks very much
Paul
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

771 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

11 Experts available now in Live!

Get 1:1 Help Now