ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA "Excel & Outlook" ************** (https://www.excelbanter.com/excel-programming/411276-vba-excel-outlook-%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A%2A.html)

James8309

VBA "Excel & Outlook" **************
 
Hi everyone,

I am having lots of difficulties with tonnes of data on back of my
head.
Basically, I have about 120 outlook emails saved on my drive. Each
email file obviously have different names.

Q: what I am trying to achieve is to be able to paste all the emails
to seperate worksheets in one workbook or look up or whatever case may
be,
Looking up values on cells A1 to A50 on activesheet on all emails then
returning the name of email that has the value on the next column B1
to B50.


What I can do now so far with help from wonderful people here in
google groups is this;

- Searching through entire worksheets for values listed from cell A1
to A50, if value is found then displaying the name of the particular
worksheet or worksheets on B1 to B50


Sub SearchAllSheets()

For i = 1 To 50
If Range("A" & i) < "" Then
Range("B" & i).ClearContents
For Each sh In Worksheets
If sh.Name < ActiveSheet.Name Then
Set searchresult = sh.Cells.Find(Range("A" & i), _
lookat:=xlPart)
If Not searchresult Is Nothing Then
Range("B" & i) = Range("B" & i) & " " & " | " & sh.Name
End If
End If
Next
End If
Next


End Sub



stefan onken

VBA "Excel & Outlook" **************
 
hi James,
you need a macro to import all your emails in different sheets of a
workbook.
use the macro-recorder to record the import of one email.
post your code here to create a loop for all emails (are they in the
same directory?)

stefan


On 21 Mai, 09:15, James8309 wrote:
Hi everyone,

I am having lots of difficulties with tonnes of data on back of my
head.
Basically, I have about 120 outlook emails saved on my drive. Each
email file obviously have different names.

Q: what I am trying to achieve is to be able to paste all the emails
to seperate worksheets in one workbook or look up or whatever case may
be,
Looking up values on cells A1 to A50 on activesheet on all emails then
returning the name of email that has the value on the next column B1
to B50.

What I can do now so far with help from wonderful people here in
google groups is this;

- Searching through entire worksheets for values listed from cell A1
to A50, if value is found then displaying the name of the particular
worksheet or worksheets on B1 to B50

Sub SearchAllSheets()

For i = 1 To 50
If Range("A" & i) < "" Then
Range("B" & i).ClearContents
For Each sh In Worksheets
If sh.Name < ActiveSheet.Name Then
Set searchresult = sh.Cells.Find(Range("A" & i), _
lookat:=xlPart)
If Not searchresult Is Nothing Then
Range("B" & i) = Range("B" & i) & " " & " | " & sh.Name
End If
End If
Next
End If
Next

End Sub




All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com