Code to search for all occurrences of text then copy the associated row to a new sheet.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

I am creating a sheet which emails various team members the results of a monthly report. Each of them has a different function and I need the code to search for the function name then copy the whole row on which it finds the occurrence. This needs to loop as many times as my other code counts functions. Any thoughts?


These links cover everything you need:
1. Send Emails from Excel
2. Looping in Excel
3. Lookup cell in VBA (using VLOOKUP from Excel)

What you need to do:
1. Create a loop like so:
for i = 1 to Range(“NAME_COLUMN_HEADER).End(xlDown).Row – Range(“NAME_COLUMN_HEADER”).Row
TeamMemberName = Range(“NAME_COLUMN_HEADER).Offset(i).Value
‘…Your code here…
Next i
2. Do a VLOOKUP based on the TeamMemberName with WorksheetFunctions
3. Use the code for Sending Emails

Simply the best place to learn Excel VBA