Results 1 to 2 of 2

Thread: Delete table last row

  1. #1

    Delete table last row

    I'm trying to delete the last row of my table. I recorded a macro to "track the path" and modified as I wanted, but it isn't working and I don't know why. Do you guys know what I can do?

    This is the code:
    Sub DeleteLastRow()    Dim aux As Long
        lrTest = Sheets("Monthly Expenses").Range("B" & Rows.Count).End(xlUp).Row
        aux = lrTest - 22
        Selection.ListObject.ListRows(aux).Delete
    End Sub
    Sub DeleteLastRow()
    Dim aux As Long
    lrTest = Sheets("Monthly Expenses").Range("B" & Rows.Count).End(xlUp).Row
    aux = lrTest - 22
    Selection.ListObject.ListRows(aux).Delete
    End Sub

    It gives me error "91". I guess it's something with this "ListRows(aux)". I already tested the "lrTest" (last row test) and I gives me the right value.

    Ps: I tried to link "ExcelForum"'s and "MrExcel"'s posts, but it won't let me through. There's a post with identical title on both forums.
    Ps2: That's whats happening when I post my code between the tags, so in order to be clean to read, I'm posting it below without tags.

  2. #2
    It was solved on "ExcelForum"'s post.

Posting Permissions

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