+ Reply to Thread
Results 1 to 2 of 2

Auto insert rows?

Hybrid View

jillteresa Auto insert rows? 11-28-2006, 01:11 PM
Carim Hi Jill, Follwing code... 11-28-2006, 01:52 PM
  1. #1
    Registered User
    Join Date
    05-13-2004
    Posts
    42

    Auto insert rows?

    Hi there -
    Is there a way to automatically insert 2 rows after the text in column B changes?


    B
    Group 1
    Group 1
    Group 1
    Group 1
    Group 2 <--Auto insert 2 rows here
    Group 2
    Group 3 <--Auto insert 2 rows here
    Group 3
    Group 3
    Group 3

    Thanks!
    Jill

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Jill,

    Follwing code should help

    Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
            If .Cells.Count > 1 Then Exit Sub
            If Intersect(.Cells, Me.Range("B:B")) Is Nothing Then Exit Sub
            If Target.Value <> Target.Offset(-1, 0).Value Then
            Target.EntireRow.Insert
            Target.EntireRow.Insert
            End If
    End With
    End Sub
    HTH
    Carim

+ Reply to Thread

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