+ Reply to Thread
Results 1 to 5 of 5

Insert Row by a defined Number

  1. #1
    Registered User
    Join Date
    09-15-2005
    Posts
    90

    Lightbulb Insert Row by a defined Number

    I have a macro that inserts a line, how can i modify it to insert a line by a number in a cell corresponding to the row number?

    ex:

    J8: "22"
    Inserts a new row between rows 22 and 23

    J8:"10"
    Inserts a new row between rows 10 and 11

  2. #2
    Registered User
    Join Date
    06-30-2005
    Posts
    23

    Insert Row

    Quote Originally Posted by comotoman
    I have a macro that inserts a line, how can i modify it to insert a line by a number in a cell corresponding to the row number?

    ex:

    J8: "22"
    Inserts a new row between rows 22 and 23

    J8:"10"
    Inserts a new row between rows 10 and 11
    Comotoman,

    Not sure if this is what you are looking for but hope it helps. Let me know.

    Sub InsertRow()
    Rows("23:23").Select
    Selection.Insert Shift:=xlDown
    Rows("11:11").Select
    Selection.Insert Shift:=xlDown
    End Sub


    This will insert rows between 22 and 23 and 10 and 11.

    Good Luck,
    zero

  3. #3
    Registered User
    Join Date
    09-15-2005
    Posts
    90
    Sub InsertRow()
    Rows("23:23").Select
    Selection.Insert Shift:=xlDown
    Rows("11:11").Select
    Selection.Insert Shift:=xlDown
    End Sub

    i need the row number determined by a cell on the active sheet.

    j8: '15'
    Sub InsertRow()
    Rows("15:15").Select
    Selection.Insert Shift:=xlDown
    End Sub

  4. #4
    Registered User
    Join Date
    06-30-2005
    Posts
    23
    Quote Originally Posted by comotoman
    Sub InsertRow()
    Rows("23:23").Select
    Selection.Insert Shift:=xlDown
    Rows("11:11").Select
    Selection.Insert Shift:=xlDown
    End Sub

    i need the row number determined by a cell on the active sheet.

    j8: '15'
    Sub InsertRow()
    Rows("15:15").Select
    Selection.Insert Shift:=xlDown
    End Sub
    I tried this code and based on the cell value in J8 it will jump down to that line and insert a row.

    Sub Insert()
    Rows(Range("j8")).Select
    Selection.Insert Shift:=xlDown
    End Sub

    If you use this code it will place one under to insert under the value of J8 or you could do negative to do it above.

    Sub Insert()
    Rows(Range("j8") + 1).Select
    Selection.Insert Shift:=xlDown
    End Sub

    Maybe alittle closer to what you need?

    zero

  5. #5
    Registered User
    Join Date
    09-15-2005
    Posts
    90

    Talking

    Thats it, thanks

+ 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