![]() |
Perform Lookup and delete non matching rows?
Can anybody help? I'm getting there but still pretty new to this and
this is my first VBA experience with lookups. I have a s/sheet with 200 rows. I have a list (the lookup list) with a column of 30 rows. Now, I wish to check each of the values in Column A of the 200 rows on the first s/sheet and, if there is not a matching entry in the lookup list column I want to delete the row. Is lookup the best option for this or should I use multiple IF statements? If it is where do I start? Thanks, Adrian ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Perform Lookup and delete non matching rows?
Adrian,
If I'm understanding your problem correctly, it's similar to some I've had. Maybe there's a more elegant way, but I've just brute-forced it with nested For..Next loops. The outer loop would go from 1 to 200 and read in the matching variable from your 200-member list; the inner loop would go from 1 to 30 and read in the matchng variable from the 30-member list. Then you use an if statement to see if they match. If the variables are string you have to use StrComp. Then use the outer index to identify the row to delete. Hope this helps. -----Original Message----- Can anybody help? I'm getting there but still pretty new to this and this is my first VBA experience with lookups. I have a s/sheet with 200 rows. I have a list (the lookup list) with a column of 30 rows. Now, I wish to check each of the values in Column A of the 200 rows on the first s/sheet and, if there is not a matching entry in the lookup list column I want to delete the row. Is lookup the best option for this or should I use multiple IF statements? If it is where do I start? Thanks, Adrian ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ . |
All times are GMT +1. The time now is 08:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com