+ Reply to Thread
Results 1 to 6 of 6

Auto adding a row and coping data from cretin columns

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    Minnesota USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Auto adding a row and coping data from cretin columns

    I have a spreadsheet that I need to auto add a row when I place a number in a column ("E")
    I did get some help from abousetta on adding the row (THANK YOU) but I still have another problem I need to add the row and copy data from only a couple of the columns ("H", "I"and J) I tryed a number of things (Target.Resize(Target.Offset(-1).Value).EntireRow.Filldown) This add every column.
    Help anyone

    This is what I have so far.
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect([E15:E200], Target) Is Nothing Then
    If Target.Cells.Count = 1 And Target.Row > 1 Then
    If Target.Offset(-1).Value <> vbNullString And Application.IsNumber(Target.Offset(-1).Value) = True Then
    Target.Resize(Target.Offset(-1).Value).EntireRow.Insert Shift:=xlDow

    End If
    End If
    End If
    End Sub

    Thanks
    Wiln2lrn

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Auto adding a row and coping data from cretin columns

    I assumed you wanted to add it at the last used row. If you want it inserted in the same row that you change a number then code will need to be edited

    Please Login or Register  to view this content.
    If you wanted it in the same row then this:

    Please Login or Register  to view this content.
    Last edited by stnkynts; 02-14-2013 at 07:26 PM.

  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    Minnesota USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Auto adding a row and coping data from cretin columns

    I'll Give them a try thanks

    Wiln2lrn

  4. #4
    Registered User
    Join Date
    01-17-2013
    Location
    Minnesota USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Auto adding a row and coping data from cretin columns

    Stnkynts
    Thanks again for the help the second of the two worked
    One thing I need to do is to be able to put the value of how many Rows I need to add
    Any ideas

    Thanks
    Wiln2lrn

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Auto adding a row and coping data from cretin columns

    Like this. It will prompt you to enter how many rows you want to enter:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-17-2013
    Location
    Minnesota USA
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Auto adding a row and coping data from cretin columns

    stnkynts
    Thanks
    I did some changes but your program gave me the perfect layout.
    Here is what I came up with, it lets me enter the row value needed in column "E", and copy the column's I need in front and behind column "E" and shift them down.



    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rNum As Integer
    If Not Intersect([E11:E19], Target) Is Nothing Then
    If IsNumeric(Target.Value) And Target.Row > 1 And Not IsEmpty(Target) Then
    On Error Resume Next
    Application.DisplayAlerts = False
    rNum = Target.Value - 1
    On Error GoTo 0
    Application.DisplayAlerts = True
    If Not IsNumeric(rNum) Or rNum = False Then Exit Sub
    Target.Offset(1, 0).Resize(rNum, 1).EntireRow.Insert Shift:=xlDown
    Target.Offset(0, 1).Resize(rNum + 1, 4).FillDown
    Target.Offset(0, -2).Resize(rNum + 1, 2).FillDown
    End If
    End If
    End Sub


    Thanks Again for the help

    Wiln2lrn

+ 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