Results 1 to 5 of 5

Automatically Insert Rows, slight change in code required

Threaded View

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Derbyshire, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Automatically Insert Rows, slight change in code required

    Hi there experts, this may turn out to be a really dumb question, so if it is, i apologize in advance.

    I have this VBA code

    Sub Test()
        Dim Rng As Range
        Dim x As Long
    '   *** Change starting row and column reference to suit ***
        Set Rng = Range("B1:B" & Range("B65536").End(xlUp).Row)
        For x = Rng.Rows.Count To 2 Step -1
            If Rng.Cells(x, 1).Offset(-1, 0).Value <> Rng.Cells(x, 1).Value Then
                Rng.Cells(x, 1).EntireRow.Insert Shift:=xlDown
            End If
        Next x
    End Sub
    this inserts 1 row, but i really want it to insert the 64 rows and then set of data (say A1 - a64 in sheet2) in column C.

    Role User Name (data in A1 - A64)
    D:PP_GENERAL_VIEW_UK_INK ALLELI
    D:PP_GENERAL_VIEW_UK_INK ANDRWA
    D:PP_GENERAL_VIEW_UK_INK ASHTSI
    D:PP_GENERAL_VIEW_UK_INK ASPINI
    D:PP_GENERAL_VIEW_UK_INK AUDRMI
    D:PP_GENERAL_VIEW_UK_INK BACORO
    D:PP_GENERAL_VIEW_UK_INK BALLNI
    D:PP_GENERAL_VIEW_UK_INK BARLCH
    Last edited by arlu1201; 09-05-2012 at 06:44 AM.

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