Requirement:
The user has a data sheet that will have different row counts each time the user runs a macro of 'DeleteLastRow'.
The last row has only 1 cell with data that isn't in Column A. The user is wanting to delete that row.
It basically would be the row after the row that has data entered in Column A.
The code the user currently has is:
The above code is deleting last row with data in column A. What revision does the user need make to delete the following row, regardless of line count?
https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1214273-delete-last-row
Solution:
Sub Test() Rows(Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row).EntireRow.Delete End Sub
Obtained from the OzGrid Help Forum.
Solution provided by Mumps.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
How to use looping to delete cells of similar value |
How to delete a row if cell in range contains specific text |
How to delete rows containing certain keywords in cells |
How to delete rows with no value |
How to loop each row if there is data after green colour cell then delete |
How to use VBA to delete rows based on multiple conditions |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.