PDA

View Full Version : Help required: segregation of data



satish gubbi
02-02-2012, 11:27 PM
Hi

I have the data extract from outlook which shows inbox and sent items data. now I need to segregate the mails based on the subject line which has been "replied" and "Forwarded" along with the initial mail found in Inbox

out of sheet1, separate sheets should be generated for mails replied, mails forwarded and mails unattended. unattended mails would be mails for which neither reply nor forward found in Sent Items

Kindly help

georgiboy
02-03-2012, 12:59 AM
If you created the sheets "RE" "FW" and "Unattended" then this would work, its a bit crude but it is how i would have done it ;)

Sub MailSorter()
Dim rCell As Range, Ender As Long

Ender = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Row

For Each rCell In Sheets("Sheet1").Range("D1:D" & Ender).Cells
If Left(rCell.Value, 3) = "RE:" Then
rCell.EntireRow.Copy
Sheets("RE").Rows(Sheets("RE").Range("D" & Rows.Count).End(xlUp).Row + 1).PasteSpecial xlAll
ElseIf Left(rCell.Value, 3) = "FW:" Then
rCell.EntireRow.Copy
Sheets("FW").Rows(Sheets("FW").Range("D" & Rows.Count).End(xlUp).Row + 1).PasteSpecial xlAll
Else
rCell.EntireRow.Copy
Sheets("Unattended").Rows(Sheets("Unattended").Range("D" & Rows.Count).End(xlUp).Row + 1).PasteSpecial xlAll
End If
Next rCell

End Sub

Hope this helps

satish gubbi
02-03-2012, 06:45 AM
Hi georgiboy

Thank your very for the reply, its working, however I need slight changes in the code, I have attached file explaining the request

and its not copying header for RE and FW sheets

kindly help me in this regard

satish gubbi
02-07-2012, 09:14 AM
Hi

Please help me with the above request

georgiboy
02-10-2012, 06:59 AM
Don't mean to be rude but i am offering help here. If you want someone to do your work for you then you could always hire someone ;)

Unless someone else here is willing to write your code for you line by line?