Excel trim function maybe?

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top