View Single Post
  #21   Report Post  
Posted to microsoft.public.excel.newusers
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Adding a loop to conditional delete code

Mark,

If you apply the Data Autofilter and select 16 from the dropdown at the top of the age column, you
will be shown just those rows with 16s.

If you select those cells that are shown and copy them, you can paste them into a new sheet, and
Excel will only paste the rows that were visible when you did the copy. That would keep the rows in
order.

Or we can modify the macro to restore the original order, and allow you to pick the age (or age
range) that you want to see.

HTH,
Bernie
MS Excel MVP


"maw via OfficeKB.com" <u12713@uwe wrote in message news:64cf4568ba1b8@uwe...
Still trying to get my head round this as its far beyond my usual Excel
capability!

Maybe I should explain a little more. I'm a researcher for a childrens
charity and I regularly have to construct samples using data pulled from our
SQL Server into an Excel file. Usually the sample has an upper age limit
(sometimes a lower one too). Usually samples aren't so big so I can manually
filter and use a macro to de-dupe. But this one is quite large. Each row has
a unique ID such as 123456, a unique child ID such as 8765, a UK postcode
such as YO10 5JL and then the child's age.

So my data looks like:

123456 | 8765 | YO10 5JL | 24 |
333568 | 1236 | E54 6KG | 13 |
436543 | 4690 | W34 7BM | 16 |


What I need to do is delete all rows where the child age is 16 or over but I
do need to keep the rows in order so that in the above example I would be
left with:

333568 | 1236 | E54 6KG | 13 |

Hope this makes sense and sorry for any (my) confusuion,

Thanks again,

Mark

SteveW wrote:
There was a :) in the post


--
www familyfund org uk

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...l-new/200608/1