ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Need help with an Excel macro



  1995 Mondeo Speed Machine
Anyone good with writing excel macros? I need one that will find the last row in a worksheet and delete it. The row number will always be different. I've found things online that say how to find the last line but I don't know how to then convert it into a line of code that will delete it as well. My knowledge of macros goes about as far as recording them and thats it...

If anyone could help me out it would be bloody marvelous.

Ta

Ric
 
  1995 Mondeo Speed Machine
Its got to be an automated process unfortunately, hence it needs to be done through a macro!
 
  RenaultSport Clio 172
I've done this somewhere before mate, I'll have a dig around. Think it was on an accounting package i built for someone..
 
  R35 GTR
record---->

ctrl-end

then delete....

entire row.

end.

ermmm doesnt work too well, just tried.
 
Last edited:
  RenaultSport Clio 172
bollox, deleted it mate, sorry. have a look on google though, or if ya fancy it, just record a load of macros and have a look at what the code does. VBA's quite intuitive so you might be able to figure it out
 
  RenaultSport Clio 172
Fook it, done it for ya

Sub Macro1()
'
' Macro1 Macro
'

'
ActiveCell.SpecialCells(xlLastCell).Select
Selection.EntireRow.Delete
End Sub

Having seen Dave's edit, i tried it properly and it's a bummer cos it doesn't delete the cell from the actual sheet, it's still referenced. Ahh well, show's ya what good quick fixes are!
 
Last edited:
  1995 Mondeo Speed Machine
Nice one mate cheers. The doc that I've been working on is at work so I'll try it tomorrow but I just did a quick test of it here and it seems to work ok. :)
 


Top