macro to delete last row in a range

  • Thread starter Thread starter vikram
  • Start date Start date
V

vikram

Hi all,

Do we have a way with which we can find the last row in a range o
cells.


like i have a worksheet where there is some data and i want that
macro should find out the range which consists data and delete the las
row automatically.

thank u all for ur hel
 
There may be another way that only takes one line but i have come u
with:

a = Range("A1:A5").Rows.Count - 1
Range("A1:A5").Cells.Offset(a, 0).EntireRow.Delete

Dunca
 
thanks for ur help but it is not deleting the last row and i hav
changed the range to A1:Z50
 
Oops- this should work a bit better!

a = Range("A1:A10").Rows.Count - 1
Range("A1").Offset(a, 0).EntireRow.Delete

Dunca
 
Sub Delrows()
Dim a

a = Range("A1:z500").Rows.Count - 1
Range("A1").Offset(a, 0).EntireRow.Select

End Sub

If this selects the wrong row I must have misunderstood what you are
trying to do. If so, post more details poss with a sample file- no
macros pls!

Duncan
 
what i want is that it shud find the last row of the range which ca
vary and automatically deletes that row

ur macro is selecting row500


like i have dta in first 60 rows, what i want is that it finds out th
60th row nd deletes it

thanks so muc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top