Hi!
I need to Filter An array of data by a criteria(emails), then the filtered results has to be pasted in other sheet, at a specific row(the row corresponding to each email address), but if there are two or many rows that has to be pasted, excel has to add the additional rows in the sheet. I will leave here the macro recorder code I have made for two of the email Addresses from the list.
Thanks in advance!
I need to Filter An array of data by a criteria(emails), then the filtered results has to be pasted in other sheet, at a specific row(the row corresponding to each email address), but if there are two or many rows that has to be pasted, excel has to add the additional rows in the sheet. I will leave here the macro recorder code I have made for two of the email Addresses from the list.
Code:
Sub Find_email_copy_paste()
'
' Find_email_copy_paste Macro
'
'
Sheets("cheat").Select
Selection.Copy
Sheets("EMP_Log").Select
ActiveSheet.Range("$A$1:$G$8458").AutoFilter Field:=7, Criteria1:= _
"First@email.com"
Sheets("CR_Matrix").Select
Columns("N:N").Select
Selection.Find(What:="First@email.com", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("N9").Select
Sheets("EMP_Log").Select
Range("D426").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("CR_Matrix").Select
Range("P9").Select
ActiveSheet.Paste
Sheets("cheat").Select
Range("A3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("EMP_Log").Select
ActiveSheet.Range("$A$1:$G$8458").AutoFilter Field:=7, Criteria1:= _
"Second@email.com"
Sheets("CR_Matrix").Select
Columns("N:N").Select
Selection.Find(What:="Second@email.com", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range("P13").Select
Sheets("EMP_Log").Select
Range("D8081").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("CR_Matrix").Select
ActiveSheet.Paste
Range("P14").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Sheets("EMP_Log").Select
Range("D8173").Select
Selection.Copy
Sheets("CR_Matrix").Select
ActiveSheet.Paste
End Sub
Thanks in advance!