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:
But I am quite unsure about adding additional conditions. I'd update some sample worksheet later.
Many thanks for your insights.
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
Many thanks for your insights.