ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy a worksheet to another xls file (https://www.excelbanter.com/excel-programming/283976-copy-worksheet-another-xls-file.html)

Jac[_2_]

copy a worksheet to another xls file
 
I have made a macro using with a VB function which generates a new
worksheet. I want to copy the generated worksheet into a new xls-file which
I want to create by a dialog-save file. Can anyone give me some simple
example code?

Jac



Chip Pearson

copy a worksheet to another xls file
 
Jac,

Try something like the following:

Dim FName As Variant
ActiveSheet.Copy
FName = Application.GetSaveAsFilename(filefilter:="Excel
files (*.xls),*.xls")
If FName < False Then
ActiveWorkbook.SaveAs FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jac" wrote in message
.. .
I have made a macro using with a VB function which generates a

new
worksheet. I want to copy the generated worksheet into a new

xls-file which
I want to create by a dialog-save file. Can anyone give me some

simple
example code?

Jac





Jac[_2_]

copy a worksheet to another xls file
 
Thanks

"Chip Pearson" schreef in bericht
...
Jac,

Try something like the following:

Dim FName As Variant
ActiveSheet.Copy
FName = Application.GetSaveAsFilename(filefilter:="Excel
files (*.xls),*.xls")
If FName < False Then
ActiveWorkbook.SaveAs FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jac" wrote in message
.. .
I have made a macro using with a VB function which generates a

new
worksheet. I want to copy the generated worksheet into a new

xls-file which
I want to create by a dialog-save file. Can anyone give me some

simple
example code?

Jac








All times are GMT +1. The time now is 03:38 PM.

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