Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows programmatically David Bateman Excel Worksheet Functions 1 March 6th 05 02:10 AM
programmatically fix no. of rows and columns simonchia Excel Programming 1 October 28th 04 09:17 AM
Hiding rows programmatically tjtjjtjt Excel Programming 2 June 18th 04 04:02 AM
Selecting Rows Programmatically Aaron Lampkin Excel Programming 1 September 5th 03 01:42 PM
Sorting rows programmatically Michael Monteiro Excel Programming 1 September 3rd 03 03:52 PM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"