mato01
asked on
Delete All Rows after Last Row with Data
I need to go to the last row with data, and delete all the rows after that row.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The above code suggestions would need to be modified, if Column A for some reason doesn't always have the last row of data.
Otherwise, perhaps UsedRange could be used to avoid that...
This should work:
With ActiveSheet
.Range(.Cells(UsedRange.Ro ws.Count+1 ,1),.Cells (.Rows.Cou nt,1)).Ent ireRow.Del ete
End With
Dave
Otherwise, perhaps UsedRange could be used to avoid that...
This should work:
With ActiveSheet
.Range(.Cells(UsedRange.Ro
End With
Dave
>>The above code suggestions would need to be modified, if Column A for some reason doesn't always have the last row of data.
The above was miss-stated. Michael74's code would work just fine.
Dave
The above was miss-stated. Michael74's code would work just fine.
Dave
Dim LastR As Long
With ActiveSheet
LastR=.cells(.rows.count,1
.Range(lastr+1 & ":" & .rows.count).delete
End with