Results 1 to 3 of 3

how to insert multiple rows in excel 2010 between data

Threaded View

  1. #1
    Registered User
    Join Date
    05-17-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    2

    how to insert multiple rows in excel 2010 between data

    I am trying to insert rows in between part numbers or job numbers on the attached spreadsheet. I am new to this forum and it seems really helpful. I have the following code, but unsuccessful. It would be awesome if someone could improve upon this code.



    Sub InsertRowsV4()

    Dim lLastRow As Long
    Dim i As Long
    Application.ScreenUpdating = False
    lLastRow = Range("A" & Rows.Count).End(xlUp).Row
    For i = lLastRow - 1 To 2 Step -1
    If Range("A" & i + 1).Value - Range("A" & i).Value > 0 Then
    On Error Resume Next
    Range("A" & i + 1).Resize(Range("A" & i + 1).Value - Range("A" & i).Value - 1, 1).EntireRow.Insert
    On Error GoTo 0
    End If
    Next 'i
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1