Adding lines when data changes in a column
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Adding lines when data changes in a column

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    How do I write a macro to insert a line at a change in value of one column?


  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    On 2002-02-18 22:05, Cindy wrote:
    How do I write a macro to insert a line at a change in value of one column?

    Cindy
    Use the worksheet change event
    Enter code in the sheets code page
    Ie. Right click sheet tab
    select view code
    paste this code;

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Assumes column to test is 1
    If Target.Column = 1 Then
    'Insert cell
    Target.Offset(1, 0).Insert Shift:=xlDown
    'Insert Row
    'Target.Offset(1, 0).EntireRow.Insert
    End If
    End Sub

    Not sure if you wanted to insert ENTIRE
    row or just a cell gave both options.


    HTH

    Ivan

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com