Deleting the texts in columns which have a value in another column on the same line

%3CLINGO-SUB%20id%3D%22lingo-sub-2302712%22%20slang%3D%22en-US%22%3EDeleting%20the%20texts%20in%20columns%20which%20have%20a%20value%20in%20another%20column%20on%20the%20same%20line%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2302712%22%20slang%3D%22en-US%22%3E%3CP%3EI%20want%20to%20delete%20the%20email%20addresses%20in%20a%20column%20of%20those%20persons%20who%20have%20donated%20money%20(which%20is%20contained%20in%20a%20separate%20column%20on%20the%20same%20line).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2302712%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2303022%22%20slang%3D%22en-US%22%3ERe%3A%20Deleting%20the%20texts%20in%20columns%20which%20have%20a%20value%20in%20another%20column%20on%20the%20same%20line%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2303022%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1039710%22%20target%3D%22_blank%22%3E%40siefedub%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20say%20the%20email%20addresses%20are%20in%20E2%20and%20down%2C%20and%20the%20amount%20of%20money%20donated%20in%20M2%20and%20down.%3C%2FP%3E%0A%3CP%3ERun%20the%20following%20macro%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ESub%20ClearEmail()%0A%20%20%20%20Dim%20r%20As%20Long%0A%20%20%20%20Dim%20m%20As%20Long%0A%20%20%20%20Application.ScreenUpdating%20%3D%20False%0A%20%20%20%20m%20%3D%20Range(%22M%22%20%26amp%3B%20Rows.Count).End(xlUp).Row%0A%20%20%20%20For%20r%20%3D%202%20To%20m%0A%20%20%20%20%20%20%20%20If%20Range(%22M%22%20%26amp%3B%20r).Value%20%26lt%3B%26gt%3B%20%22%22%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20Range(%22E%22%20%26amp%3B%20r).ClearContents%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20Next%20r%0A%20%20%20%20Application.ScreenUpdating%20%3D%20True%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I want to delete the email addresses in a column of those persons who have donated money (which is contained in a separate column on the same line).

1 Reply

@siefedub 

Let's say the email addresses are in E2 and down, and the amount of money donated in M2 and down.

Run the following macro:

Sub ClearEmail()
    Dim r As Long
    Dim m As Long
    Application.ScreenUpdating = False
    m = Range("M" & Rows.Count).End(xlUp).Row
    For r = 2 To m
        If Range("M" & r).Value <> "" Then
            Range("E" & r).ClearContents
        End If
    Next r
    Application.ScreenUpdating = True
End Sub