Biedubbeljoe
Active Member
- Joined
- Aug 16, 2004
- Messages
- 308
Hi,
I have a list of emails (different every week) that needs to be matched against a workbook. All emails on that list needs to be deleted in the workbook. I recorded a Excel Macro but it needs adjustment.
The first email on column J (J1) needs to be processed, then the next etc. till the last email from the list. Only the email address from the J column list are lined up for deleting all matching emails in the workbook. Can somebody please adjust my code below:
Sub Macro1()
'
' Macro1 Macro
'
'
Range("J2").Select
Selection.Cut
Cells.Replace What:="1@email.com", Replacement:="", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Application.CutCopyMode = False
Range("J3").Select
Selection.Cut
Cells.Replace What:="2@email.com", Replacement:="", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Application.CutCopyMode = False
Range("J4").Select
Selection.Cut
Cells.Replace What:="3@email.com", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("J4").Select
Application.CutCopyMode = False
Range("J5").Select
Selection.Cut
Cells.Replace What:="4@email.com", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("J5").Select
Application.CutCopyMode = False
Range("J6").Select
End Sub
I have a list of emails (different every week) that needs to be matched against a workbook. All emails on that list needs to be deleted in the workbook. I recorded a Excel Macro but it needs adjustment.
The first email on column J (J1) needs to be processed, then the next etc. till the last email from the list. Only the email address from the J column list are lined up for deleting all matching emails in the workbook. Can somebody please adjust my code below:
Sub Macro1()
'
' Macro1 Macro
'
'
Range("J2").Select
Selection.Cut
Cells.Replace What:="1@email.com", Replacement:="", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Application.CutCopyMode = False
Range("J3").Select
Selection.Cut
Cells.Replace What:="2@email.com", Replacement:="", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Application.CutCopyMode = False
Range("J4").Select
Selection.Cut
Cells.Replace What:="3@email.com", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
False, ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("J4").Select
Application.CutCopyMode = False
Range("J5").Select
Selection.Cut
Cells.Replace What:="4@email.com", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Range("J5").Select
Application.CutCopyMode = False
Range("J6").Select
End Sub