ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Range to new workbook (https://www.excelbanter.com/excel-programming/276829-copy-range-new-workbook.html)

mmasters

Copy Range to new workbook
 
I am wondering how I would copy a specified range to a new workbook
using VBA.

1. Make the selection in the in and place the contents in the
first workbook -- WB1 -- onto the clipboard.

2. Create / add a new workbook -- call this WB2.

3. Past the contents of the clipboard to WB2

If anyone has some code that I can look at it would be greatly
appreciated as I can make this work with a new worksheet but and
messing it up with the new workbook.

Thanks for the help.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Robin Hammond

Copy Range to new workbook
 
Sub CopyRangeToNewBook()
Sheets("Sheet1").Range("a1:b2").Copy
Workbooks.Add
ActiveSheet.Paste
End Sub

--
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"mmasters" wrote in message
...
I am wondering how I would copy a specified range to a new workbook
using VBA.

1. Make the selection in the in and place the contents in the
first workbook -- WB1 -- onto the clipboard.

2. Create / add a new workbook -- call this WB2.

3. Past the contents of the clipboard to WB2

If anyone has some code that I can look at it would be greatly
appreciated as I can make this work with a new worksheet but and
messing it up with the new workbook.

Thanks for the help.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:18 PM.

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