Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removind row where next is almost equal

Status
Not open for further replies.

manrique83

Programmer
Apr 26, 2005
36
US
I have the following rows

Account Tin Action
111111 4444444
111111 4444444 disregard
111111 4444444 checked

I need to keep rows where there is no action. If there is an action and it is fixed, I need to keep that one instead. I have come up with the programming logic, but my macro is getting nowhere.

Here is the pseudo code.

Read record
Save as old
Read next record
Save as new
If new record (Account and TIN) = old record (Account and Tin)
if new record (Action) = "checked"
keep new record
delete old record
else
keep new record
delete old record
End if


the records are sorted and will always be " ", "checked", "fixed
 


Hi,

I'd use the AutoFilter to display the row(s) to be deleted, and delete visible rows.

Do it manually to figure out what workd.

Then macro record it.

Post back your code if you need help cleaning it up.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Thanks SkipVought,

But all records are unique already, except that I am trying to keep only one record where Account and Tin match. If the action is "checked", keep that one, else if the action is "disregard", keep that one.
I am not familiar with Excel VBA so my macro isn't even useful. can you provide hints?

Thanks alot
 

???

Filter on Action

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Dont know what you mean? Im a giving a confusing explanation?
 

Are you in Excel or Access?

If Access, then post this in forum705

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Im in excel and i would like a sample macro that would do what i have provided.
 

Activate your sheet.

Activate HELP

Read up on AutoFilter!

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top