+ Reply to Thread
Results 1 to 2 of 2

Trying to add more rows to a table based on existing data

  1. #1
    Registered User
    Join Date
    12-06-2012
    Location
    El Paso, TX
    MS-Off Ver
    Excel 2007
    Posts
    14

    Trying to add more rows to a table based on existing data

    I would like to be able to use this code to add more rows with these formulas to the bottom of the already existing data. I have been able to get things relative to the first cell, but I dont know how to make the first cell relative to the end of the previously entered data.

    Sub test()

    Sheets("Logbook").Select

    Range("n4").Select
    ActiveCell.FormulaR1C1 = _
    "=IF(ISBLANK(rc[-12]),"""",VLOOKUP(rc[-12],Tail_Make,2))"

    ' Cross Country look up
    ActiveCell.Offset(columnOffset:=5).Activate
    ActiveCell.FormulaR1C1 = _
    "=IF(ISNUMBER(RC[179]),IF(RC[179]>50,""Y"",""""),"""")"

    ActiveCell.Offset(columnOffset:=3).Activate
    ActiveCell.FormulaR1C1 = _
    "=IF(ISBLANK(RC[-15]),"""",ROUND(IF(RC[-15]>RC[-14],(23-HOUR(RC[-15]-RC[-14]))+(60-MINUTE(RC[-15]-RC[-14]))/60,HOUR(RC[-14]-RC[-15])+MINUTE(RC[-14]-RC[-15])/60),2))"

    Range("A4:v4").Select
    Selection.AutoFill Destination:=Range("A4:v51"), Type:=xlFillDefault
    End Sub
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    11-20-2012
    Location
    Seattle, WA USA
    MS-Off Ver
    Excel 2010
    Posts
    597

    Re: Trying to add more rows to a table based on existing data

    use this code to find the last row of a specific column

    Please Login or Register  to view this content.
    or


    use this code to find the last row of the active sheet
    Please Login or Register  to view this content.
    then you can use an offset(1) to drop it down to the next blank line
    Last edited by scott.s.fower; 04-19-2013 at 04:39 PM.

+ 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