Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting rows programmatically | Excel Worksheet Functions | |||
programmatically fix no. of rows and columns | Excel Programming | |||
Hiding rows programmatically | Excel Programming | |||
Selecting Rows Programmatically | Excel Programming | |||
Sorting rows programmatically | Excel Programming |