ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Certain Rows (https://www.excelbanter.com/excel-programming/319876-delete-certain-rows.html)

scrabtree23[_3_]

Delete Certain Rows
 
I would like a VBA code to delete certain rows on a sheet.

If I use xldown it will go to the last row of data in a table. There is
more data on the sheet below this but there is a line that is skipped between
the target table and the additional data. So, I want to select cell A:1,
then do an xldown to get to the last row in the target table. I then want to
delete row 3:3 through the desired last row.

How?

Thanks

Dave Peterson[_5_]

Delete Certain Rows
 
dim LastCell as range
with worksheets("sheet1")
set lastcell = .range("a1").end(xldown)
.range("a3",lastcell).entirerow.delete
end with

Would be one way.

scrabtree23 wrote:

I would like a VBA code to delete certain rows on a sheet.

If I use xldown it will go to the last row of data in a table. There is
more data on the sheet below this but there is a line that is skipped between
the target table and the additional data. So, I want to select cell A:1,
then do an xldown to get to the last row in the target table. I then want to
delete row 3:3 through the desired last row.

How?

Thanks


--

Dave Peterson

Bob Phillips[_6_]

Delete Certain Rows
 

cLastRow = Cells(Rows.Count,"A").end(xlUp).Row
Range("A3:A" & clastrow).entirerow.delete

--

HTH

RP
(remove nothere from the email address if mailing direct)


"scrabtree23" wrote in message
...
I would like a VBA code to delete certain rows on a sheet.

If I use xldown it will go to the last row of data in a table. There is
more data on the sheet below this but there is a line that is skipped

between
the target table and the additional data. So, I want to select cell A:1,
then do an xldown to get to the last row in the target table. I then want

to
delete row 3:3 through the desired last row.

How?

Thanks





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

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