ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Export worksheet only (https://www.excelbanter.com/excel-programming/374092-export-worksheet-only.html)

tony wong

Export worksheet only
 
i only wish to export one of the worksheets only to another excel file.

it seems i can only export the whole workbook and delete other worksheets.

i try to use Worksheets("ABC").Delete but there is popup for yes or no
after.

how can i make it better? Thanks a lot.

tony



Charles Chickering

Export worksheet only
 
Tony, Try: Sheets("YourSheet").Copy
by not specifing a location it creates a new workbook, which becomes active.
You can then save the activeworkbook to the name you want or to the sheet
name if you wish:
ActiveWorbook.SaveAs(ActiveSheet.Name,xlNormal)
or you could set the new workbook to a variable if you have other things you
wish to do with it:
Dim wb as Workbook
set wb = ActiveWorkbook
wb.SaveAs....

does that help any?


--
Charles Chickering

"A good example is twice the value of good advice."


"tony wong" wrote:

i only wish to export one of the worksheets only to another excel file.

it seems i can only export the whole workbook and delete other worksheets.

i try to use Worksheets("ABC").Delete but there is popup for yes or no
after.

how can i make it better? Thanks a lot.

tony




tony wong

Export worksheet only
 
Thanks a lot Charles

it works to me.


"Charles Chickering" ...
Tony, Try: Sheets("YourSheet").Copy
by not specifing a location it creates a new workbook, which becomes
active.
You can then save the activeworkbook to the name you want or to the sheet
name if you wish:
ActiveWorbook.SaveAs(ActiveSheet.Name,xlNormal)
or you could set the new workbook to a variable if you have other things
you
wish to do with it:
Dim wb as Workbook
set wb = ActiveWorkbook
wb.SaveAs....

does that help any?


--
Charles Chickering

"A good example is twice the value of good advice."


"tony wong" wrote:

i only wish to export one of the worksheets only to another excel file.

it seems i can only export the whole workbook and delete other
worksheets.

i try to use Worksheets("ABC").Delete but there is popup for yes or no
after.

how can i make it better? Thanks a lot.

tony







All times are GMT +1. The time now is 08:49 PM.

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