EliseFreedman
Programmer
Hi There
I have been working on a spreadsheet which contains information about overdue reports from different managers within the business. The information is all contained within a single spreadsheet. I want to be able to email each manager individually with the details of only his/her overdue statements
At the moment I have got it to the stage where I can select a manager from the drop down combo box, click on filter report and it filters it for that manager then emails him. (See Code Below) I would now like to modify it so that at the click of a button, it works its way through all items in the listbox (values of which are taken from a list elsewhere in the spreadsheet: Cells N3:O731 on Menu Sheet In workbook), filters the data for that manager then sends the email then moves on to the next manager in the list. I am not sure how to do this. I had a wee play about with loops but got nowhere!! Can anyone point me in the right direction?
My code is currently as follows
I have been working on a spreadsheet which contains information about overdue reports from different managers within the business. The information is all contained within a single spreadsheet. I want to be able to email each manager individually with the details of only his/her overdue statements
At the moment I have got it to the stage where I can select a manager from the drop down combo box, click on filter report and it filters it for that manager then emails him. (See Code Below) I would now like to modify it so that at the click of a button, it works its way through all items in the listbox (values of which are taken from a list elsewhere in the spreadsheet: Cells N3:O731 on Menu Sheet In workbook), filters the data for that manager then sends the email then moves on to the next manager in the list. I am not sure how to do this. I had a wee play about with loops but got nowhere!! Can anyone point me in the right direction?
My code is currently as follows
Code:
Sub FilterData_Location()
Worksheets("Criteria").Select
' Local Variables
Dim blnProjIdMatch As Boolean, blnCustIDMatch As Boolean
Dim rngProjStatus As Range
Dim strProjID As String, strCustID As String
Dim strProjID2 As String
Dim AreaName As String
' Step 1 : Retrieve information
Range("c_SelProjID") = Range("G1")
strProjID = Range("c_SelProjID")
strProjID2 = " " & strProjID
' Step 2 : Clear any existing data
Worksheets("Criteria").Range("7:65536").ClearContents
' Step 4 : Get relevant data from status page(which contains all data for all managers)and copy to criteria page (contains only filtered data)
For Each rngProjStatus In Range("ps_ProjectNums")
blnProjIdMatch = False
If rngProjStatus = strProjID2 Or strProjID2 = "" Then blnProjIdMatch = True
If blnProjIdMatch = True Then
rngProjStatus.EntireRow.Copy Destination:=Worksheets("Criteria").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next rngProjStatus
Call RemoveValidation
'Step 5 : Email attached spreadsheet to appropriate Manager
Call Mail_ActiveSheet
End Sub