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

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading...
Go back to All Questions Login or Register
749 views
0

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?

0

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 VBA!

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match