Hopefully this will give you some ideas. The coding for sending mails have to be implemented yet (instead of my messagebox -- you could use a call to the sendmail routine and pass the email address to this function).
'---------------------------------------------------------------------------------------
' Procedure : send_mails_for_workbook
' Author : Charlize
' Date : 1/09/2008
' Purpose : Process every sheet in workbook exept 'Master Sheet' and 'Data'
'---------------------------------------------------------------------------------------
'
Sub send_mails_for_workbook()
'workbook
Dim mywb As Workbook
'worksheet
Dim mysheet As Worksheet
'name of worksheet we look for to get emailaddress
Dim myvalue As Range
'the mailaddress
Dim mymailaddress As String
Set mywb = ActiveWorkbook
'For each sheet in workbook exept Master Sheet and Data
For Each mysheet In mywb.Worksheets
If mysheet.Name <> "Master Sheet" And _
mysheet.Name <> "Data" Then
'Define the range where we need to look for name
With mywb.Worksheets("Master Sheet").Range("A2:A" & _
mywb.Worksheets("Master Sheet").Range("A" & _
Rows.Count).End(xlUp).Row)
'Search for name
Set myvalue = .Find(mysheet.Name, LookIn:=xlValues)
'if name is found
If Not myvalue Is Nothing Then
'store offset value in string
mymailaddress = myvalue.Offset(, 1).Value
'change this line with your routine for sending mail
MsgBox "Send mail for " & mysheet.Name & vbCrLf & _
"at " & mymailaddress
End If
End With
End If
'go on with next sheet
Next mysheet
End Sub
Charlize
Bookmarks