Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Find and Copy ?

Each month I receive a workbook with approx 70 wkshts in it. These
sheets are never in the same order and the sheets are only numbered "sheet1"
etc. The sheets are then identified and copied into one of seven existing
wkbks (each with approx 10 wkshts).

The 70 worksheets are identified because A1:A5 give details i.e. A4 or
A5 names the wkbk it is to be copied into and A2 or A3 names the actual
wksht it is to be copied to.

Could anybody help with this problem, indeed is it do-able

As I see it, I need to

Open one of the 7 existing wkbks as well as the new 70 sheet wkbk.
Ask it to compare page 1 A1:A5 with each of the 70 wkshts until it finds a
match.
Then copy the found sheet, back to the original (existing)
Then move to the next page and repeat until all 10 sheets from the 1st book
has been found.
Then open book 2 and repeat .

Any assistance gratefully received,

Bob




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find and Copy ?

Might as well "deal out" the sheets all at once. Use code something like:

Dim sh as Worksheet
Dim sBook as String, sSh as String
Dim wkbk as Workbook
workbooks.Open "C:\bk1.xls"
workbooks.Open "C:\bk2.xls"
workbooks.Open "C:\bk3.xls"
workbooks.Open "C:\bk4.xls"
workbooks.Open "C:\bk5.xls"
workbooks.Open "C:\bkof70.xls"

for each sh in Workbooks("bkof70.xls).Worksheets
if instr(sh.Range("A4"),"xls") then
sBook = sh.Range("A4").value
sSh = sh.Range("A2").Value
else
sBook = sh.Range("A5").Value
sSh = sh.Range("A3").Value
end if
set wkbk = workbooks(sBook)
sh.Copy After:=wkbk.Worksheets(wkbk.Worksheets.count)
wkbk.Worksheets(wkbk.Worksheets.count).Name = sSh
Next

workbooks("bk1.xls").Close SaveChanges:=True
workbooks("bk2.xls").Close SaveChanges:=True
workbooks("bk3.xls").Close SaveChanges:=True
workbooks("bk4.xls").Close SaveChanges:=True
workbooks("bk5.xls").Close SaveChanges:=True

--
Regards,
Tom Ogilvy


Robert Gillard wrote in message
...
Each month I receive a workbook with approx 70 wkshts in it. These
sheets are never in the same order and the sheets are only numbered

"sheet1"
etc. The sheets are then identified and copied into one of seven existing
wkbks (each with approx 10 wkshts).

The 70 worksheets are identified because A1:A5 give details i.e. A4 or
A5 names the wkbk it is to be copied into and A2 or A3 names the actual
wksht it is to be copied to.

Could anybody help with this problem, indeed is it do-able

As I see it, I need to

Open one of the 7 existing wkbks as well as the new 70 sheet wkbk.
Ask it to compare page 1 A1:A5 with each of the 70 wkshts until it finds

a
match.
Then copy the found sheet, back to the original (existing)
Then move to the next page and repeat until all 10 sheets from the 1st

book
has been found.
Then open book 2 and repeat .

Any assistance gratefully received,

Bob






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
find and copy it.. reza Excel Discussion (Misc queries) 1 April 21st 10 03:40 AM
Copy contents of Find (Find and Replace) rob_bob Excel Discussion (Misc queries) 0 March 26th 09 11:01 PM
Find in XML and Copy S1L1Y1 Excel Discussion (Misc queries) 0 May 19th 08 05:50 PM
Find and Copy Help Excel Discussion (Misc queries) 2 February 28th 08 09:54 PM
find and copy Lost Excel Worksheet Functions 1 October 1st 05 06:15 PM


All times are GMT +1. The time now is 05:28 AM.

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

About Us

"It's about Microsoft Excel"