ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete all rows except (https://www.excelbanter.com/excel-discussion-misc-queries/178245-delete-all-rows-except.html)

Marilyn

Delete all rows except
 
Hello ( Excel 2002)My worksheet has about 3900 rows. I need to delete all
rows that do not have the following numbers
15,16,18,21,23,40,106,108,110,114,(there is a total of 34 different numbers)
These numbers are found in column A. also I do not want to delete row 1
that has the titles. I need a macro because I have over 100 files . Help
and Thanks

Ron de Bruin

Delete all rows except
 
Hi Marilyn

See
http://www.rondebruin.nl/delete.htm

You can use this example from the site in the macro

Replace
If .Value = "ron" Then .EntireRow.Delete

With

If IsError(Application.Match(.Value, _
Array(15, 16, 18), 0)) Then .EntireRow.Delete

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Marilyn" wrote in message ...
Hello ( Excel 2002)My worksheet has about 3900 rows. I need to delete all
rows that do not have the following numbers
15,16,18,21,23,40,106,108,110,114,(there is a total of 34 different numbers)
These numbers are found in column A. also I do not want to delete row 1
that has the titles. I need a macro because I have over 100 files . Help
and Thanks


Marilyn

Delete all rows except
 
Thank You Ron. EXCELLENT!

"Ron de Bruin" wrote:

Hi Marilyn

See
http://www.rondebruin.nl/delete.htm

You can use this example from the site in the macro

Replace
If .Value = "ron" Then .EntireRow.Delete

With

If IsError(Application.Match(.Value, _
Array(15, 16, 18), 0)) Then .EntireRow.Delete

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Marilyn" wrote in message ...
Hello ( Excel 2002)My worksheet has about 3900 rows. I need to delete all
rows that do not have the following numbers
15,16,18,21,23,40,106,108,110,114,(there is a total of 34 different numbers)
These numbers are found in column A. also I do not want to delete row 1
that has the titles. I need a macro because I have over 100 files . Help
and Thanks




All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com