ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying shts from one wbk to another (https://www.excelbanter.com/excel-programming/272684-copying-shts-one-wbk-another.html)

jacqui[_2_]

Copying shts from one wbk to another
 

What would be the equivalent in VBA code to the Right
click on the worksheet tab where you can then Copy the
sheet or sheets to another workbook (which in this case
would be a new one).

Can anyone help?

Many thanks
Jacqui

Rob Bovey

Copying shts from one wbk to another
 
Hi Jacqui,

This macro will copy the first worksheet in the workbook where it runs
into a new workbook:

Sub CopySheet()
ThisWorkbook.Worksheets(1).Copy
End Sub

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

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"jacqui" wrote in message
...

What would be the equivalent in VBA code to the Right
click on the worksheet tab where you can then Copy the
sheet or sheets to another workbook (which in this case
would be a new one).

Can anyone help?

Many thanks
Jacqui




J.E. McGimpsey

Copying shts from one wbk to another
 
One way:

ActiveWindow.SelectedSheets.Copy

In article ,
"jacqui" wrote:

What would be the equivalent in VBA code to the Right
click on the worksheet tab where you can then Copy the
sheet or sheets to another workbook (which in this case
would be a new one).

Can anyone help?

Many thanks
Jacqui



All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com