Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copy tab from one spreadsheet to multiple tabs in another spreadsheetwhile retaining the targets spreadsheets tab names

Hi All,

Thanks in advance for your help. I need a macro please:

I am using Excel 2003.

I have a spreadsheet called Blank_ACD. It only has one tab in it and
this tab is called Weekly ACD Report.
File is located in C:\ACD.

I have another spreadsheet that is called Comp_Acd. This spreadsheet
has 52 tabs for each week of the year named after the ending day of
the week (Friday being that day) so the names are like 07-Jan-2011 ,
14-Jan-2011, 21-Jan-2011, 28-Jan-2011 & so on until 30-Dec-2011. File
is also located in C:\ACD.

What I want is a macro that would copy one tab from one spreadsheet to
multiple tabs in another spreadsheet while retaining the targets
spreadsheets tab names.

In my case copy the Weekly ACD Report tab from c:\acd\ Blank_ACD to c:
\acd\Comp_Acd into all the weekly tabs in Comp_Acd while retaining
the existing 52 week tab names in Comp_Acd.

Additionally this macro must also accommodate the name changes for the
next year when the 52 tabs in Comp_Acd will reflect the ending
Fridays for 2012. And so on to the years after that.

Thanks

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Copy tab from one spreadsheet to multiple tabs in another spreadsheet while retaining the targets spreadsheets tab names

See in-line comments and macro at end.

On Wed, 5 Jan 2011 09:46:32 -0800 (PST), Dave wrote:

Hi All,

Thanks in advance for your help. I need a macro please:

I am using Excel 2003.

I have a spreadsheet called Blank_ACD. It only has one tab in it and
this tab is called Weekly ACD Report.
File is located in C:\ACD.

I have another spreadsheet that is called Comp_Acd. This spreadsheet
has 52 tabs for each week of the year named after the ending day of
the week (Friday being that day) so the names are like 07-Jan-2011 ,
14-Jan-2011, 21-Jan-2011, 28-Jan-2011 & so on until 30-Dec-2011. File
is also located in C:\ACD.

What I want is a macro that would copy one tab from one spreadsheet to
multiple tabs in another spreadsheet while retaining the targets
spreadsheets tab names


You cannot copy a sheet tab into another sheet tab

You want to copy the contents of Weekly ACD Report and append those contents to
the contents of 52 sheets in Comp_Acd workbook, right?


In my case copy the Weekly ACD Report tab from c:\acd\ Blank_ACD to c:
\acd\Comp_Acd into all the weekly tabs in Comp_Acd while retaining
the existing 52 week tab names in Comp_Acd.


Sheet names won't change if you are appending data as above.


Additionally this macro must also accommodate the name changes for the
next year when the 52 tabs in Comp_Acd will reflect the ending
Fridays for 2012. And so on to the years after that.


No need for that, thefollowing macro will work no matter what the sheet names
are.

Thanks

Dave


Sub append_data()

Dim ws As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Sheets("Weekly ACD Report").UsedRange
Workbooks.Open Filename:= _
" C:\ACD\Comp_Acd.xls"
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
Set rng2 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
rng1.Copy Destination:=rng2
Next ws
With ActiveWorkbook
.Save
.Close
End With

End Sub


Gord Dibben MS Excel MVP
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Copy tab from one spreadsheet to multiple tabs in another spreadsheet while retaining the targets spreadsheets tab names

NOTE

Macro assumes that workbook Blank_ACD is currently open.


Gord

On Wed, 05 Jan 2011 12:02:06 -0800, Gord Dibben wrote:

See in-line comments and macro at end.

On Wed, 5 Jan 2011 09:46:32 -0800 (PST), Dave wrote:

Hi All,

Thanks in advance for your help. I need a macro please:

I am using Excel 2003.

I have a spreadsheet called Blank_ACD. It only has one tab in it and
this tab is called Weekly ACD Report.
File is located in C:\ACD.

I have another spreadsheet that is called Comp_Acd. This spreadsheet
has 52 tabs for each week of the year named after the ending day of
the week (Friday being that day) so the names are like 07-Jan-2011 ,
14-Jan-2011, 21-Jan-2011, 28-Jan-2011 & so on until 30-Dec-2011. File
is also located in C:\ACD.

What I want is a macro that would copy one tab from one spreadsheet to
multiple tabs in another spreadsheet while retaining the targets
spreadsheets tab names


You cannot copy a sheet tab into another sheet tab

You want to copy the contents of Weekly ACD Report and append those contents to
the contents of 52 sheets in Comp_Acd workbook, right?


In my case copy the Weekly ACD Report tab from c:\acd\ Blank_ACD to c:
\acd\Comp_Acd into all the weekly tabs in Comp_Acd while retaining
the existing 52 week tab names in Comp_Acd.


Sheet names won't change if you are appending data as above.


Additionally this macro must also accommodate the name changes for the
next year when the 52 tabs in Comp_Acd will reflect the ending
Fridays for 2012. And so on to the years after that.


No need for that, thefollowing macro will work no matter what the sheet names
are.

Thanks

Dave


Sub append_data()

Dim ws As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Sheets("Weekly ACD Report").UsedRange
Workbooks.Open Filename:= _
" C:\ACD\Comp_Acd.xls"
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
Set rng2 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
rng1.Copy Destination:=rng2
Next ws
With ActiveWorkbook
.Save
.Close
End With

End Sub


Gord Dibben MS Excel MVP

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copy tab from one spreadsheet to multiple tabs in anotherspreadsheet while retaining the targets spreadsheets tab names

On Jan 5, 2:36*pm, Gord Dibben wrote:
NOTE

Macro assumes that workbook Blank_ACD is currently open.

Gord



On Wed, 05 Jan 2011 12:02:06 -0800, Gord Dibben wrote:
See in-line comments and macro at end.


On Wed, 5 Jan 2011 09:46:32 -0800 (PST), Dave wrote:


Hi All,


Thanks in advance for your help. I need a macro please:


I am using Excel 2003.


I have a spreadsheet called Blank_ACD. It only has one tab in it and
this tab is called Weekly ACD Report.
File is located in C:\ACD.


I have another spreadsheet that is called Comp_Acd. This spreadsheet
has 52 tabs for each week of the year named after the ending day of
the week (Friday being that day) so the names are *like *07-Jan-2011 ,
14-Jan-2011, 21-Jan-2011, 28-Jan-2011 *& so on until 30-Dec-2011. File
is also located in C:\ACD.


What I want is a macro that would copy one tab from one spreadsheet to
multiple tabs in another spreadsheet while retaining the targets
spreadsheets tab names


You cannot copy a sheet tab into another sheet tab


You want to copy the contents of Weekly ACD Report and append those contents to
the contents of 52 sheets in Comp_Acd workbook, right?


In my case *copy the Weekly ACD Report tab from c:\acd\ Blank_ACD to c:
\acd\Comp_Acd into all the weekly tabs in Comp_Acd *while retaining
the existing 52 week tab names in Comp_Acd.


Sheet names won't change if you are appending data as above.


Additionally this macro must also accommodate the name changes for the
next year when the 52 tabs in Comp_Acd will reflect *the ending
Fridays for 2012. And so on to the years after that.


No need for that, thefollowing macro will work no matter what the sheet names
are.


Thanks


Dave


Sub append_data()


* *Dim ws As Worksheet
* *Dim rng1 As Range
* *Dim rng2 As Range
* *Set rng1 = Sheets("Weekly ACD Report").UsedRange
* *Workbooks.Open Filename:= _
* * * * * * * * * " C:\ACD\Comp_Acd.xls"
* *For Each ws In ActiveWorkbook.Worksheets
* * * *ws.Activate
* * * *Set rng2 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
* * * *rng1.Copy Destination:=rng2
* *Next ws
* *With ActiveWorkbook
* * * *.Save
* * * *.Close
* *End With


End Sub


Gord Dibben * * MS Excel MVP- Hide quoted text -


- Show quoted text -


Gord:

Thanks for the help. The macro works great. In the C:\ACD\Comp_Acd.xls
file I have tabs that are named Monthly_Totals. I want to exclude them
from this appending process . Can this be done?

Thanks again!!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Copy tab from one spreadsheet to multiple tabs in another spreadsheet while retaining the targets spreadsheets tab names

They cannot all be named Monthly_Totals.

How many of these "excluded" sheets would there be?

Where are they located in the workbook?

There are several methods to exclude those sheets by code.

Below is one method which hides those sheets, appends to visible sheets then
unhides the sheets.

One of the brighter coders will come up with something better..........like not
hiding, I'm sure.

Sub append_data()

Dim ws As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Set rng1 = Sheets("Weekly ACD Report").UsedRange
Workbooks.Open Filename:= _
"C:\ACD\Comp_Acd.xls"
Set myarray = Sheets(Array("Month1", "Month2", "Month3", "Month4"))
myarray.Visible = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = True Then
ws.Activate
Set rng2 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
rng1.Copy Destination:=rng2
End If
Next ws
For Each ws In myarray
ws.Visible = True
Next ws
With ActiveWorkbook
.Save
.Close
End With

End Sub


Gord


On Wed, 5 Jan 2011 12:47:57 -0800 (PST), Dave wrote:

Thanks for the help. The macro works great. In the C:\ACD\Comp_Acd.xls
file I have tabs that are named Monthly_Totals. I want to exclude them
from this appending process . Can this be done?

Thanks again!!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Copy tab from one spreadsheet to multiple tabs in anotherspreadsheet while retaining the targets spreadsheets tab names

On Jan 5, 3:59*pm, Gord Dibben wrote:
They cannot all be named Monthly_Totals.

How many of these "excluded" sheets would there be?

Where are they located in the workbook?

There are several methods to exclude those sheets by code.

Below is one method which hides those sheets, appends to visible sheets then
unhides the sheets.

One of the brighter coders will come up with something better..........like not
hiding, I'm sure.

Sub append_data()

* * Dim ws As Worksheet
* * Dim rng1 As Range
* * Dim rng2 As Range
* * Set rng1 = Sheets("Weekly ACD Report").UsedRange
* * Workbooks.Open Filename:= _
* * * * * * * * * *"C:\ACD\Comp_Acd.xls"
* * Set myarray = Sheets(Array("Month1", "Month2", "Month3", "Month4"))
* * myarray.Visible = False
* * For Each ws In ActiveWorkbook.Worksheets
* * * * If ws.Visible = True Then
* * * * * * ws.Activate
* * * * * * Set rng2 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
* * * * * * rng1.Copy Destination:=rng2
* * * * End If
* * Next ws
* * For Each ws In myarray
* * * * ws.Visible = True
* * Next ws
With ActiveWorkbook
* * .Save
* * .Close
End With

End Sub

Gord



On Wed, 5 Jan 2011 12:47:57 -0800 (PST), Dave wrote:
Thanks for the help. The macro works great. In the C:\ACD\Comp_Acd.xls
file I have tabs that are named Monthly_Totals. I want to exclude them
from this appending process . Can this be done?


Thanks again!!- Hide quoted text -


- Show quoted text -


Thanks again,

There are 12 monthly sheets they come after about 4 weeks of data e.g
07-Jan-2011 ,
14-Jan-2011, 21-Jan-2011, 28-Jan-2011, Monthly_Totals

I can Name them Jan, Feb, Mar ....etc.
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
How to get range names to Apply across multiple tabs TrippKnightly Excel Worksheet Functions 1 August 10th 11 03:48 PM
Allow multiple rows of worksheet tabs for complex spreadsheets Peter Gross Excel Discussion (Misc queries) 6 June 3rd 10 12:42 PM
Exporting selected tabs multiple times to different file names Ren Excel Programming 1 November 28th 07 05:54 PM
External reference to spreadsheet names (tabs) help needed. cuyuni Excel Discussion (Misc queries) 2 July 15th 06 12:51 PM
Macro to copy all spreadsheets into 1 spreadsheet Dtown Dawg Excel Programming 6 June 7th 06 05:11 PM


All times are GMT +1. The time now is 12:45 AM.

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"