Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default VB to copy a sheet to active workbook

Howdie

I need some vb that will help solve the following...

Scenario - I got two files open

File 1 - entitled Master with sheet called final in it (always be this
set up of file and sheet name)
File 2 - VARIABLE name, ie it will change, but it can be the active book
when I run the macro.

What I need is to copy the sheet master from file 1 into file 2.

Thanks!!!!

Regards

Darin




*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB to copy a sheet to active workbook

Hi Darin

Test this one
With file 2 active

Dim Wb1 As Workbook
Dim Wb2 As Workbook
Set Wb1 = ActiveWorkbook
Set Wb2 = Workbooks("Master.xls")
Wb2.Sheets("final ").copy _
after:=Wb1.Sheets(Wb1.Sheets.Count)



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Darin Kramer" wrote in message ...
Howdie

I need some vb that will help solve the following...

Scenario - I got two files open

File 1 - entitled Master with sheet called final in it (always be this
set up of file and sheet name)
File 2 - VARIABLE name, ie it will change, but it can be the active book
when I run the macro.

What I need is to copy the sheet master from file 1 into file 2.

Thanks!!!!

Regards

Darin




*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB to copy a sheet to active workbook

I see I have a space after the sheet name "final "
Remove it before you test it

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Hi Darin

Test this one
With file 2 active

Dim Wb1 As Workbook
Dim Wb2 As Workbook
Set Wb1 = ActiveWorkbook
Set Wb2 = Workbooks("Master.xls")
Wb2.Sheets("final ").copy _
after:=Wb1.Sheets(Wb1.Sheets.Count)



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Darin Kramer" wrote in message ...
Howdie

I need some vb that will help solve the following...

Scenario - I got two files open

File 1 - entitled Master with sheet called final in it (always be this
set up of file and sheet name)
File 2 - VARIABLE name, ie it will change, but it can be the active book
when I run the macro.

What I need is to copy the sheet master from file 1 into file 2.

Thanks!!!!

Regards

Darin




*** Sent via Developersdex http://www.developersdex.com ***





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default VB to copy a sheet to active workbook

This code assumes that the code is running in th atcive workbook...

Workbooks("Master.xls").sheets("Final").Copy _
After:= ThisWorkbook.Sheets(1)

This code assumes that the code is running in Master.xls...
Thisworkbook.Sheets("Final").copy _
After:= Activeworkbook.Sheets(1)
--
HTH...

Jim Thomlinson


"Darin Kramer" wrote:

Howdie

I need some vb that will help solve the following...

Scenario - I got two files open

File 1 - entitled Master with sheet called final in it (always be this
set up of file and sheet name)
File 2 - VARIABLE name, ie it will change, but it can be the active book
when I run the macro.

What I need is to copy the sheet master from file 1 into file 2.

Thanks!!!!

Regards

Darin




*** Sent via Developersdex http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default VB to copy a sheet to active workbook



Bedankt Ron - works like a charm!

*** Sent via Developersdex http://www.developersdex.com ***
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 value from active sheet to another workbook sak New Users to Excel 2 June 19th 09 10:52 AM
Copy my active sheet to a new sheet and open with an input form Brad Withrow Excel Programming 0 April 6th 06 03:56 AM
VB Method to copy and save only one sheet of the active workbook Rock* Excel Programming 2 March 9th 06 12:33 AM
Copy from active sheet and paste into new sheet using info from cell in active Ingve Excel Programming 3 January 23rd 06 09:57 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


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