Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert Row (2000)

    I have a spreadsheet that has a column called Client Number. I would like to insert a row when the Client Number changes. The Client Number appears 4 times and then a new set of 4 Client Numbers. Is there some code I can put behind that worksheet to do this. Thanks for your help.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Insert Row (2000)

    Does this do what you want? (change the iCol to the column number to check)

    Steve
    <pre>Option Explicit
    Sub InsertRowAtChange()
    Dim iCol As Integer
    Dim rng As Range
    Dim x As Long
    iCol = 1
    Set rng = Range(Cells(1, iCol), Cells(65536, iCol).End(xlUp))
    With rng
    For x = .Count To 2 Step -1
    If .Cells(x) <> .Cells(x - 1) Then _
    .Cells(x).EntireRow.Insert
    Next
    End With
    End Sub</pre>


  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Row (2000)

    Thank you - that worked perfectly......

Posting Permissions

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