+ Reply to Thread
Results 1 to 8 of 8

Thread: Last Row in a column

  1. #1
    Registered User
    Join Date
    12-21-2011
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    36

    Last Row in a column

    Good afternoon,

    I been having trouble with absoluting the columns in my macro. I just dont know how to make it to work until the very last row of the column. I use the recording macro. but after several months my data grew so large then not all of the rows were absoluted. How do I change this macro to start from last row then work its way up in a column to absolute the values. The issue is the rows can go beyond 200,000 rows, so the 165k wont work. Any assistance is greatly appreciated.

  2. #2
    Valued Forum Contributor
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    895

    Re: Last Row in a column

    this find last row in column A
    Sub aa()
    Dim lastrow As Long
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
    Cells(lastrow, 1).Select
    End Sub
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Registered User
    Join Date
    12-21-2011
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Last Row in a column

    Thanks Tom. I will try, do I specify the last row in column F in that code? Because there will be other columns that will not have any data on the specifics rows. So I should type
    [code]
    Sub aa()
    Dim lastrow As Long
    lastrow = Worksheets("Sheet1").Cells(Rows.Count, 6).End(xlUp).Row
    Cells(lastrow, 6).Select
    End Sub
    [\code]

    correct?
    Last edited by preciouslife73; 01-14-2012 at 04:00 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    895

    Re: Last Row in a column

    yes that is ok but if you do not want use the numbers of columns you can use this
    Sub aa()
    Dim lastrow As Long
    lastrow = Worksheets("sheet1").Cells(Rows.Count, "f").End(xlUp).Row
    Range("f" & lastrow).Select
    End Sub
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  5. #5
    Registered User
    Join Date
    12-21-2011
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Last Row in a column

    Thanks! I appreciated it.

  6. #6
    Registered User
    Join Date
    12-21-2011
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Last Row in a column

    Actually it didn't work because when I tried to auto fill the absolute value from the beginning of the column
    It started at the last row. How do I make it work to start from top to last row auto fill? Below is the code:

    lastrow = Worksheets("Unmatched_Transactions").Cells(Rows.Count,
    "G").End(xlUp).Row
    ***Columns("G:G").Select
    ***Selection.Insert Shift:=xlToRight
    ***Range("G2").Select
    ***ActiveCell.FormulaR1C1 = "=ABS(RC[1])"
    ***Range("G2").Select
    ***Selection.AutoFill Destination:=Range("G" & lastrow).Select

  7. #7
    Valued Forum Contributor
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    895

    Re: Last Row in a column

    check this
    Sub aa()
    Dim lastrow As Long
    lastrow = Worksheets("Unmatched_Transactions").Cells(Rows.Count, "G").End(xlUp).Row
    Columns("G:G").Insert Shift:=xlToRight
    Range("G2").FormulaR1C1 = "=ABS(RC[1])"
    Range("G2:g" & lastrow).FillDown
    End Sub
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  8. #8
    Registered User
    Join Date
    12-21-2011
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Last Row in a column

    Thanks! It worked great!


    Quote Originally Posted by tom1977 View Post
    check this
    Sub aa()
    Dim lastrow As Long
    lastrow = Worksheets("Unmatched_Transactions").Cells(Rows.Count, "G").End(xlUp).Row
    Columns("G:G").Insert Shift:=xlToRight
    Range("G2").FormulaR1C1 = "=ABS(RC[1])"
    Range("G2:g" & lastrow).FillDown
    End Sub

+ 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.2.0