VBA for removing duplicates based on several criterias

mangodango

New Member
Joined
Aug 8, 2017
Messages
9
Hello, I am struggling iwth creating a macro, which will remove duplicates rows based on some criteria. Let's say I'd like macro to remove duplicates based on 2 columns B and V. The logic that:


1. If there are multiple rows with the same values in column B + the string value in col V is like 'Final Assessment*, I'd like macro to remove the duplicated rows.
2. If there are multiple rows with the same values in column B + and there is no 'Final Assessment' phase in col V. I'd like macro to still remove the duplicates, but to keep 1 row (ideally check if there is any other value in V and keep this one. If not the blank is also ok).




I was thinking about something like:


Code:
sub deldups


Dim src As Range


Application.ScreenUpdating = False


Set src = Worksheets("Model Report 20190227").Range("2:17783")




If (Worksheets("Model Report 20190227").Range("v2").Value Like "*Final Assessment*") Then
    Worksheets(""Model Report 20190227").CurrentRegion.RemoveDuplicates 


end if


Application.ScreenUpdating = True


end sub
But I am quite unsure about adding additional conditions. I'd update some sample worksheet later.


Many thanks for your insights.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,214,594
Messages
6,120,436
Members
448,964
Latest member
Danni317

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top