View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_4_] Alan Beban[_4_] is offline
external usenet poster
 
Posts: 171
Default Newbie : Find / Find Next

How about something like:

Set rng1=Range("deletable_number_list")
Set rng2 =Range("spreadsheet_account_number_list")
For Each iCell in rng2
If Application.Countif(iCell.value,rng1)0 then _ iCell.EntireRow.Delete
Next iCell

Alan Beban

Rich wrote:
I am using Excel 97.

I need to complish the following. I have a list of account numbers
that need to be deleted from a spreadsheet. The problem is that I
don't know how many instances of the account number is on the
spreadsheet, so I need to issue the find command again and again until
all account nubmers have been deleted. So the code might look like

1. get account number
2. find it on spreadsheet.
3. if found, delete that row.
4. continue until all instances of the account number are deleted.
5. go get next account number.

My question to you is, what is the best way to tell Excel to continue
looking for these values until all of them have been deleted.