Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Copying a sheet from an addin into an open workbook

I am trying to copy a worksheet from an addin (Toolbox) into an open workbook
(TallyFile). For some reason, the code creates a new file and pastes the
sheet all in my "Copy" line. I have also tried to first activate the
Tallybase sheet and then copy, but that didn't work either. I have done this
a few years ago, but I have forgotten how to. What am I doing wrong? The
pertinent section of code is below.


Workbooks(TallyFile).Activate
Sheets.Add
ActiveSheet.Name = TallyName

Workbooks("Toolbox.xls").Worksheets("TallyBase").C opy

' Cells.Select
' Selection.Copy
Workbooks(TallyFile).Activate
ActiveSheet.Paste

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Copying a sheet from an addin into an open workbook


Here's one way to do it:

Workbooks("Toolbox.xls").Worksheets("TallyBase").C opy _
befo=Workbooks(TallyFile).Worksheets(1)

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"OkieViking" wrote in message
...
I am trying to copy a worksheet from an addin (Toolbox) into an open
workbook
(TallyFile). For some reason, the code creates a new file and pastes the
sheet all in my "Copy" line. I have also tried to first activate the
Tallybase sheet and then copy, but that didn't work either. I have done
this
a few years ago, but I have forgotten how to. What am I doing wrong? The
pertinent section of code is below.


Workbooks(TallyFile).Activate
Sheets.Add
ActiveSheet.Name = TallyName

Workbooks("Toolbox.xls").Worksheets("TallyBase").C opy

' Cells.Select
' Selection.Copy
Workbooks(TallyFile).Activate
ActiveSheet.Paste



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Copying a sheet from an addin into an open workbook

Thanks Rob!

"Rob Bovey" wrote:


Here's one way to do it:

Workbooks("Toolbox.xls").Worksheets("TallyBase").C opy _
befo=Workbooks(TallyFile).Worksheets(1)

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"OkieViking" wrote in message
...
I am trying to copy a worksheet from an addin (Toolbox) into an open
workbook
(TallyFile). For some reason, the code creates a new file and pastes the
sheet all in my "Copy" line. I have also tried to first activate the
Tallybase sheet and then copy, but that didn't work either. I have done
this
a few years ago, but I have forgotten how to. What am I doing wrong? The
pertinent section of code is below.


Workbooks(TallyFile).Activate
Sheets.Add
ActiveSheet.Name = TallyName

Workbooks("Toolbox.xls").Worksheets("TallyBase").C opy

' Cells.Select
' Selection.Copy
Workbooks(TallyFile).Activate
ActiveSheet.Paste




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
Copying A Worksheet From Each Open Workbook to an new Workbook carl Excel Worksheet Functions 1 January 3rd 06 05:37 PM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 1 September 15th 04 01:59 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 0 September 15th 04 01:59 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 1 September 15th 04 01:48 AM
Copying a Worksheet from an AddIn into an empty Workbook Manuel Jörges Excel Programming 1 February 24th 04 02:40 PM


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