Email automatically based on information in column A

SomeCallMeGenius

Board Regular
Joined
Aug 11, 2010
Messages
61
Hi All,

I get a daily email from the MIS with details on the performance on my team members. For agents who are below a particular threshold needs to be sent email on daily basis. I have a big team, so some times this get tedious. I believe this can be automated using VB but I am not very good in it, so requesting for help from you guys.

Here is what the sheets looks like -

Sheet one
Excel Workbook
CDE
3NameProductivityPerformance
4Samantha85Excellent
5Roger75Above Average
6Christie65Average
7Alex55Below Average
8Jonathan45Poor
9David87Excellent
10Chritian67Average
11Amanda78Above Average
12Victor89Excellent
Sheet1
Excel 2007

What I want is that the macro/vb program to automatically pickup agent name whose performance index is "Average" , "Below Average" or "Poor" and also pickup their productivity figure, check their name in sheet 2 for their email address and send them an email like this -

"Hello Agent name,

Your productivity for yesterday was (mention productivity figure here), can you please let us know the reason for the same.

Thanks,
-SG
"

here is what the sheet two looks like
Excel Workbook
FG
4Alexalex@domainname.com
5AmandaAmanda@domainname.com
6ChristieChristie@domainname.com
7ChritianChritian@domainname.com
8DavidDavid@domainname.com
9JonathanJonathan@domainname.com
10RogerRoger@domainname.com
11SamanthaSamantha@domainname.com
12VictorVictor@domainname.com
Sheet1
Excel 2007

Please help me guys.

Thanks,
-SG
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Thanks for the reply, I am not really a VB guy, so can't get this working with the info in the link. Can someone give me little more help with it?
 
Upvote 0
Post what you have so far and we'll take a look.
Getting code from the ground up... well... doesn't happen a lot.
 
Upvote 0
Thanks Warship for replying so quickly.

As I said earlier, I dont know much about VB, so don't laugh at my coding :)

Here is what I have put up as of now.


Option Explicit

Sub email_agents()
Dim row As Integer
Dim row2 As Integer
Dim agent_name As String
Dim emailadd As String
Worksheets("sheet1").Activate

For row = 1 To 7
Worksheets("sheet1").Activate
If Cells(row, 4).Value = "Poor" Then
GoTo email
ElseIf Cells(row, 4).Value = "Average" Then
GoTo email
ElseIf Cells(row, 4).Value = "below Average" Then
GoTo email
Else: GoTo option2

email:
agent_name = Cells(row, 3).Value
Worksheets("emailaddress").Activate
For row2 = 1 To 7
If Cells(row2, 3).Value = agent_name Then
emailadd = Worksheets("emailaddress").Cells(row2, 4).Value
MsgBox (emailadd)
Else
End If
Next row2

option2:
End If

Next row

End Sub

I am still working on getting VB to pickup the correct email address to send the email too and havn't succeeded yet.
 
Upvote 0

Forum statistics

Threads
1,221,569
Messages
6,160,557
Members
451,656
Latest member
SBulinski1975

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top