Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copy a table from one workbook to ALL worksheets in a different wb

Hello Excel Gurus!

I need to copy a summary table that is in workbook "A" to all worksheets
contained in workbbok "B". Sometimes workbook "B" have 800+ worksheets. So I
tried to make a macro that would that for me as follows:

Windows("A.xlsm").Activate
Range("A1:B17").Select
Selection.Copy
Windows("B.xls").Activate

Dim Wks As Worksheet

For Each Wks In ActiveWorkbook.Worksheets

With Wks
Range("B31").Select
ActiveSheet.Paste
End With
Next Wks
Windows("A.xlsm").Activate
Range("D1").Select

However it is not working properly since it is not changing to the next
worksheet in the workbook. Can you help me with it please? By the way,
worksheet's number are not consecutive numbers, even some of them have been
renamed to a word like "Store1".

Thanks you in advance for any and all help!

JB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copy a table from one workbook to ALL worksheets in a different wb

I'd use something like:

Dim FromRng as range
dim wks as worksheet

with workbooks("a.xlsm").worksheets("What's the name of the worksheet")
set fromrng = .range("A1:b17")
end with

with workbooks("b.xls") 'is that the correct name/extension
for each wks in .worksheets
fromrng.copy _
destination:=wks.range("b31")
next wks
end with

Notice the dots in front of those ranges (and objects)--that means that they
belong to the object in the previous With statement.


JABAgdl wrote:

Hello Excel Gurus!

I need to copy a summary table that is in workbook "A" to all worksheets
contained in workbbok "B". Sometimes workbook "B" have 800+ worksheets. So I
tried to make a macro that would that for me as follows:

Windows("A.xlsm").Activate
Range("A1:B17").Select
Selection.Copy
Windows("B.xls").Activate

Dim Wks As Worksheet

For Each Wks In ActiveWorkbook.Worksheets

With Wks
Range("B31").Select
ActiveSheet.Paste
End With
Next Wks
Windows("A.xlsm").Activate
Range("D1").Select

However it is not working properly since it is not changing to the next
worksheet in the workbook. Can you help me with it please? By the way,
worksheet's number are not consecutive numbers, even some of them have been
renamed to a word like "Store1".

Thanks you in advance for any and all help!

JB


--

Dave Peterson
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
Copy all worksheets to another workbook, excl. duplicate sheets already in other workbook ARbitOUR[_15_] Excel Programming 2 May 27th 09 06:14 AM
Copy worksheets to a different workbook Angel C[_2_] Excel Programming 5 February 13th 09 04:36 PM
Copy worksheets within a workbook robert morris Excel Discussion (Misc queries) 0 February 24th 08 01:25 PM
Copy Worksheets from one Workbook to Another halem2 Excel Worksheet Functions 3 March 25th 06 06:04 AM
Copy four worksheets from one workbook into a new workbook.e-mail Francis Brown Excel Programming 1 October 3rd 05 12:24 AM


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

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"