![]() |
deleting rows programmatically
I import a large amount of data into excel unfortunately there are headers
or footers interspersed with the data. Sometimes the headers take up 10 rows and sometimes it takes up 11. Would it be best to identify through the len function which rows to delete? How would I programmatically remove them? |
deleting rows programmatically
Can you differentiate a header row by, say text vs numeric
.... or if the header in only in the first field (Column) while the data has multiple fields (columns) ? Does a header actually contain 10-11 rows or is it just wrapped text? "David Bateman" wrote: I import a large amount of data into excel unfortunately there are headers or footers interspersed with the data. Sometimes the headers take up 10 rows and sometimes it takes up 11. Would it be best to identify through the len function which rows to delete? How would I programmatically remove them? |
deleting rows programmatically
You need some rule to identify those rules, then it is simply a matter of
setting a range that meet the criteria, and delete the entirerow range. -- HTH RP (remove nothere from the email address if mailing direct) "David Bateman" wrote in message ... I import a large amount of data into excel unfortunately there are headers or footers interspersed with the data. Sometimes the headers take up 10 rows and sometimes it takes up 11. Would it be best to identify through the len function which rows to delete? How would I programmatically remove them? |
deleting rows programmatically
If the len function will differentiate them then sure
lastrow = cells(rows.count,1).end(xlup).row for i = lastrow to 1 step -1 if len(cells(i,1)) < 10 then cells(i,1).EntireRow.Delete end if Next if the number of cells filled in that row is the criteria lastrow = cells(rows.count,1).end(xlup).row for i = lastrow to 1 step -1 if application.countA(rows(i)) < 10 then cells(i,1).EntireRow.Delete end if Next Adjust the criteria in the IF statement to fit your situation. -- Regards, Tom Ogilvy "David Bateman" wrote in message ... I import a large amount of data into excel unfortunately there are headers or footers interspersed with the data. Sometimes the headers take up 10 rows and sometimes it takes up 11. Would it be best to identify through the len function which rows to delete? How would I programmatically remove them? |
All times are GMT +1. The time now is 10:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com