Excel trim function maybe?

G

Guest

I need to search the spreadsheet/table to find the first blank row " " -
Column A or the words "Elimination Totals". The function should delete that
row and all the rows below it. Note - each spreadsheet has elimination
totals on different rows however they are located under column C on all the
spreadsheets.

Please note that this file will be later imported to access. and also later
the macro/vba code/or functions might be cut out of excel and used into
access too.
 
G

Guest

Try this code.

Sub delrows()

lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set colARange = Range("A1:A" & lastrow)
Set c = colARange.Find(what:="Elimination Totals", _
LookIn:=xlValues)
If c Is Nothing Then
Rows("1:" & lastrow).Delete
Else
Rows("1:" & c.Row).Delete
End If


End Sub
 

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

Top