Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automating Insert Rows in Excel Table

Posted on 2012-04-12
2
Medium Priority
?
186 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
[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 Comments
 
LVL 34

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

704 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