Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Copy source sheet to end of targeted workbook

I am getting myself confused on how to do this, so I am asking instead. How
do I programmically copy the active spreadsheet (sheet1) to the open
workbook ... into the last position on the workbook?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy source sheet to end of targeted workbook


ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
..

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking instead.

How
do I programmically copy the active spreadsheet (sheet1) to the open
workbook ... into the last position on the workbook?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Copy source sheet to end of targeted workbook

Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the active one ...
how would I do that. My failure to ask the correct question ... I want to
copy the spreadsheet in the active workbook to the last position in the
second workbook which is open behind the first. (I hope that makes sense).


"Bob Phillips" wrote in message
...

ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking instead.

How
do I programmically copy the active spreadsheet (sheet1) to the open
workbook ... into the last position on the workbook?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy source sheet to end of targeted workbook

Assuming that you know the name of the workbook

With Workbooks("SIP 2004.xls")
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the active one

....
how would I do that. My failure to ask the correct question ... I want to
copy the spreadsheet in the active workbook to the last position in the
second workbook which is open behind the first. (I hope that makes

sense).


"Bob Phillips" wrote in message
...

ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking

instead.
How
do I programmically copy the active spreadsheet (sheet1) to the open
workbook ... into the last position on the workbook?








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Copy source sheet to end of targeted workbook

Now that's a good question .... I think you can see why I'm confused ... I
had used a code similar to this and was not getting anywhere ... I will not
know the name of the workbook. The first one will always be a new workbook
and the second one I'm copying to will change names every month based on the
name of the month (i.e., May.xls, June.xls).

Is it possible to write such a code that could accomplish this feat ... or
is that out of line for Excel?


"Bob Phillips" wrote in message
...
Assuming that you know the name of the workbook

With Workbooks("SIP 2004.xls")
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the active one

...
how would I do that. My failure to ask the correct question ... I want

to
copy the spreadsheet in the active workbook to the last position in the
second workbook which is open behind the first. (I hope that makes

sense).


"Bob Phillips" wrote in message
...

ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking

instead.
How
do I programmically copy the active spreadsheet (sheet1) to the open
workbook ... into the last position on the workbook?












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy source sheet to end of targeted workbook

Dim oWB As Workbook
For Each oWB In Workbooks
If oWB.Name < Thsisworkbook.Name Then
With oWB
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
Exit For
End With
End If
Next oWB

But you have a problem if there are more than 2 workbooks, as there is no
way of knowing which other one will be hit first.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Now that's a good question .... I think you can see why I'm confused ... I
had used a code similar to this and was not getting anywhere ... I will

not
know the name of the workbook. The first one will always be a new

workbook
and the second one I'm copying to will change names every month based on

the
name of the month (i.e., May.xls, June.xls).

Is it possible to write such a code that could accomplish this feat ... or
is that out of line for Excel?


"Bob Phillips" wrote in message
...
Assuming that you know the name of the workbook

With Workbooks("SIP 2004.xls")
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the active

one
...
how would I do that. My failure to ask the correct question ... I

want
to
copy the spreadsheet in the active workbook to the last position in

the
second workbook which is open behind the first. (I hope that makes

sense).


"Bob Phillips" wrote in message
...

ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking

instead.
How
do I programmically copy the active spreadsheet (sheet1) to the

open
workbook ... into the last position on the workbook?












  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Copy source sheet to end of targeted workbook

Cool .. this works .. and I even figured out the little error ... (very
proud of myself!) look below and see if you see it! Thanks, Bob!


"Bob Phillips" wrote in message
...
Dim oWB As Workbook
For Each oWB In Workbooks
If oWB.Name < Thsisworkbook.Name Then
With oWB
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
Exit For
End With
End If
Next oWB

But you have a problem if there are more than 2 workbooks, as there is no
way of knowing which other one will be hit first.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Now that's a good question .... I think you can see why I'm confused ...

I
had used a code similar to this and was not getting anywhere ... I will

not
know the name of the workbook. The first one will always be a new

workbook
and the second one I'm copying to will change names every month based on

the
name of the month (i.e., May.xls, June.xls).

Is it possible to write such a code that could accomplish this feat ...

or
is that out of line for Excel?


"Bob Phillips" wrote in message
...
Assuming that you know the name of the workbook

With Workbooks("SIP 2004.xls")
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the active

one
...
how would I do that. My failure to ask the correct question ... I

want
to
copy the spreadsheet in the active workbook to the last position in

the
second workbook which is open behind the first. (I hope that makes
sense).


"Bob Phillips" wrote in message
...

ActiveSheet.copy
after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking
instead.
How
do I programmically copy the active spreadsheet (sheet1) to the

open
workbook ... into the last position on the workbook?














  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy source sheet to end of targeted workbook

Well I got all of the right letters, just too many of them..

I never said I tested it<vbg

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Cool .. this works .. and I even figured out the little error ... (very
proud of myself!) look below and see if you see it! Thanks, Bob!


"Bob Phillips" wrote in message
...
Dim oWB As Workbook
For Each oWB In Workbooks
If oWB.Name < Thsisworkbook.Name Then
With oWB
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
Exit For
End With
End If
Next oWB

But you have a problem if there are more than 2 workbooks, as there is

no
way of knowing which other one will be hit first.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Now that's a good question .... I think you can see why I'm confused

....
I
had used a code similar to this and was not getting anywhere ... I

will
not
know the name of the workbook. The first one will always be a new

workbook
and the second one I'm copying to will change names every month based

on
the
name of the month (i.e., May.xls, June.xls).

Is it possible to write such a code that could accomplish this feat

....
or
is that out of line for Excel?


"Bob Phillips" wrote in message
...
Assuming that you know the name of the workbook

With Workbooks("SIP 2004.xls")
ActiveWorkbook.ActiveSheet.copy _
after:=.Worksheets(.Worksheets.Count)
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
Well .. that worked supremely ... but I asked the question wrong!

I want to move it to another workbook that is open behind the

active
one
...
how would I do that. My failure to ask the correct question ... I

want
to
copy the spreadsheet in the active workbook to the last position

in
the
second workbook which is open behind the first. (I hope that

makes
sense).


"Bob Phillips" wrote in

message
...

ActiveSheet.copy

after:=ActiveWorkbook.Worksheets(ActiveWorkbook.Wo rksheets.Count)
.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Annette" wrote in message
...
I am getting myself confused on how to do this, so I am asking
instead.
How
do I programmically copy the active spreadsheet (sheet1) to

the
open
workbook ... into the last position on the workbook?
















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 copy Formatting Attributes from Source Workbook when Linkin m_egle Excel Worksheet Functions 3 July 9th 09 08:39 PM
Excel-how to link source workbook to copy of destination workbook D Lynn Excel Worksheet Functions 1 May 29th 08 05:36 PM
copy pivot table and source from workbook 1 to 2. dakotasteve Excel Discussion (Misc queries) 0 September 27th 06 06:05 PM
Copy tabs(sheets) from workbook without link to original source Rich Ulichny Excel Discussion (Misc queries) 3 August 25th 05 02:11 AM
Copy tabs(sheets) from workbook without link to original source Rich Ulichny Links and Linking in Excel 2 August 9th 05 03:26 PM


All times are GMT +1. The time now is 05:11 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"