Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,045
Default How to extract email addresses from 1 worksheet to another workbook

On Thu, 1 Dec 2011 18:34:40 -0800 (PST), Mark wrote:

On Nov 28, 4:14*pm, Ron Rosenfeld wrote:
On Sun, 27 Nov 2011 22:20:11 -0800 (PST), Mark wrote:
So we have
declared that wb is a Workbook but we haven't defined which workbooks
it should be searching to get the information.


The workbook that wb gets assigned to is via the :

For Each wb In Workbooks

statement.

Then we except the wb that you have the results going into, and we should also be skipping any wb's that don't have an "Admin" worksheet. *So I don't understand your error you mentioned in your next post, unless possibly that workbook had an Admin worksheet, but had its data on the Administration worksheet.


Thanks for that explanation, makes sense now.

I can see the code there that should be skipping over wb's without an
"Admin" sheet but it definitely errors when it has a different name
(also no "Admin" sheet on the one with the incorrect name).

In a perfect World I'd have the code skipping over those books but I'm
ok to do the better housekeeping to keep all wb's consistent.

Thanks Again


Puzzling over the code, I think I have found the problem. Once ws gets set to an admin worksheet, it remains set there, and doesn't go back to "nothing" when we check the next wb. Hence the error.

Try adding

Set ws = Nothing

in that section as shown below, and that should take care of the error.

--------------------------

For Each wb In Workbooks
If Not wb.Name = "Book2" Then 'or whatever book holds the results
Set ws = Nothing
On Error Resume Next
Set ws = wb.Worksheets("Admin")
On Error GoTo 0
If Not ws Is Nothing Then
Set rSrc = wb.Worksheets("Admin").UsedRange

-------------------------------------------------
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I would like to extract email addresses from an Excel document ladyblue214 Excel Discussion (Misc queries) 1 May 8th 10 10:40 AM
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
Using Advanced Filter to extract email addresses Frank Wood Excel Discussion (Misc queries) 4 March 1st 07 10:54 PM
Extract email addresses Excel Worksheet Functions 9 December 15th 06 09:05 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM


All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"