ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create New Spread From Old Worksheet (https://www.excelbanter.com/excel-programming/401392-create-new-spread-old-worksheet.html)

Joe K.

Create New Spread From Old Worksheet
 

I have a spreadsheet with several worksheets, I would like to copy only the
(RIC) worksheet to new spreadsheet. I would like the new spreadsheet to use
same folder location as the old spreadhsheet and the name with the following
format: 'Den' + DDMMYYYYHHMMSS

Please help me complete this task.

Thanks,

Dave Peterson

Create New Spread From Old Worksheet
 
Option Explicit
Sub Testme01()
dim ActWkbk as workbook

set actwkbk = activeworkbook

actwkbk.worksheets("Ric").copy 'to a new sheet

with activesheet 'new ric sheet in new workbook
.parent.saveas filename:=actwkbk.path & "\" & "Den" & _
format(now, "ddmmyyyyhhmmss")
.parent.close savechanges:=false
end with
end sub

Joe K. wrote:

I have a spreadsheet with several worksheets, I would like to copy only the
(RIC) worksheet to new spreadsheet. I would like the new spreadsheet to use
same folder location as the old spreadhsheet and the name with the following
format: 'Den' + DDMMYYYYHHMMSS

Please help me complete this task.

Thanks,


--

Dave Peterson

Dave Peterson

Create New Spread From Old Worksheet
 
Minor modifications...

Option Explicit
Sub Testme01()
dim ActWkbk as workbook

set actwkbk = activeworkbook

actwkbk.worksheets("Ric").copy 'to a new sheet in a new workbook

with activesheet 'new ric sheet in new workbook
.parent.saveas filename:=actwkbk.path & "\" & "Den" & _
format(now, "ddmmyyyyhhmmss") & ".xls"
.parent.close savechanges:=false
end with
end sub

I modified the comment on the .copy line and added ".xls" to the workbook name.

Dave Peterson wrote:

Option Explicit
Sub Testme01()
dim ActWkbk as workbook

set actwkbk = activeworkbook

actwkbk.worksheets("Ric").copy 'to a new sheet

with activesheet 'new ric sheet in new workbook
.parent.saveas filename:=actwkbk.path & "\" & "Den" & _
format(now, "ddmmyyyyhhmmss")
.parent.close savechanges:=false
end with
end sub

Joe K. wrote:

I have a spreadsheet with several worksheets, I would like to copy only the
(RIC) worksheet to new spreadsheet. I would like the new spreadsheet to use
same folder location as the old spreadhsheet and the name with the following
format: 'Den' + DDMMYYYYHHMMSS

Please help me complete this task.

Thanks,


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 08:03 AM.

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