Adding/removing rows in Excel
Is there an easy way of making code change automatically
to make allowance for adding or removing rows in a spreadsheet, without manually changing the code ? |
Adding/removing rows in Excel
Assume column A can be used to find the number of rows
set rng = Range(cells(1,1),cells(rows.count,1).End(xlup)) for each cell in rng If you have a data table/database construct set rng = range("a1").CurrentRegion in either case Dim lastrow as Long lastrow = rng.rows(rng.row.count).row for i = lastrow to 1 step -1 if cells(lastrow,1).Value = 0 then cells(lastrow,1).EntireRow.Delete end if Next as an example. -- Regards, Tom Ogilvy "Don" wrote in message ... Is there an easy way of making code change automatically to make allowance for adding or removing rows in a spreadsheet, without manually changing the code ? |
All times are GMT +1. The time now is 03:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com