ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel trim function maybe? (https://www.excelbanter.com/excel-programming/398862-excel-trim-function-maybe.html)

Nakli

Excel trim function maybe?
 
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.

--
Tech Learner

joel

Excel trim function maybe?
 
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

"Nakli" wrote:

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.

--
Tech Learner



All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com