Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a Macro that pulls data from a text file into a spreadsheet. I need
new to delete some rows that don't contain certain data. Office Number for example. If the office number on my spreadsheet is not in a list, I need to delete the row. I can use a loop, but my list has about 40 offices. I tried using Lookup, but it doesn't quite work. I think my lookup command is a little off, I only want to compare to one column, Column A in Office. Here is the part of the code. I am deleting from the bottom up. Y = Range("XY61!A" & Rows.Count).End(xlUp).Row Do While Y < 6 Test = Application.Lookup(Range("XY61!B" & Y), Range("Office!$A$2:$A$84"), Range("Office!$A$2:$A$84")) If IsError(Test) Then Range("XY61!B" & Y).EntireRow.Delete End If Y = Y - 1 Loop Thank you in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 Macro/VB Question DDE Question | Excel Worksheet Functions | |||
VB Macro question | Excel Discussion (Misc queries) | |||
Macro question | Excel Discussion (Misc queries) | |||
question on macro | Excel Discussion (Misc queries) | |||
macro question | Excel Programming |