If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Save single worksheet as new workbook
I have a workbook containing multiple worksheets. I would like a macro
that would save a single worksheet as a new file. Also, can I have the new file be saved as the data in a certain cell? I have a macro that will save the worksheet to a new workbook, but it saves it with the same filename each time. Please help! Thanks -GorillaBoze --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Save single worksheet as new workbook
Hi GorillaBoze
One way is to use a date time stamp in the file name Example that save the activesheet in C:\ Or look in the VBA help for Application.GetSaveAsFilename Sub CopySave_ActiveSheet() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "dd-mm-yy h-mm-ss") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\Part of " & ThisWorkbook.Name _ & " " & strdate & ".xls" .Close False End With Application.ScreenUpdating = True End Sub For a cell value use ..SaveAs Sheets("mysheet").Range("d1").Value -- Regards Ron de Bruin http://www.rondebruin.nl "GorillaBoze " wrote in message ... I have a workbook containing multiple worksheets. I would like a macro that would save a single worksheet as a new file. Also, can I have the new file be saved as the data in a certain cell? I have a macro that will save the worksheet to a new workbook, but it saves it with the same filename each time. Please help! Thanks -GorillaBoze --- Message posted from http://www.ExcelForum.com/ |
#3
|
|||
|
|||
Save single worksheet as new workbook
I am having problems when I try to use a cell value. I am trying to
use: .SaveAs "Z:\SecDept\ Sheets("Tax40").Range("A10").Value & " " & strdate & ".xls" Is this correct? --- Message posted from http://www.ExcelForum.com/ |
#4
|
|||
|
|||
Save single worksheet as new workbook
Hi,
Not quite: Try: ..SaveAs "Z:\SecDept\" & Sheets("Tax40").Range ("A10").Value & " " & strdate & ".xls" jeff -----Original Message----- I am having problems when I try to use a cell value. I am trying to use: .SaveAs "Z:\SecDept\ Sheets("Tax40").Range("A10").Value & " " & strdate & ".xls" Is this correct? --- Message posted from http://www.ExcelForum.com/ . |
#5
|
|||
|
|||
Save single worksheet as new workbook
That works! Thanks Jeff
I have a question though...why does it not work when I add another folder to the location? .saveas "Z:\SecDept\Recommendations" & Sheets("Tax40").Range ("A10").Value & " " & strdate & ".xls" --- Message posted from http://www.ExcelForum.com/ |
#6
|
|||
|
|||
Save single worksheet as new workbook
Use this
.SaveAs "Z:\SecDept\" & Sheets("Tax40").Range("A10").Value _ & " " & strdate & ".xls" -- Regards Ron de Bruin http://www.rondebruin.nl "GorillaBoze " wrote in message ... I am having problems when I try to use a cell value. I am trying to use: SaveAs "Z:\SecDept\ Sheets("Tax40").Range("A10").Value & " " & strdate & ".xls" Is this correct? --- Message posted from http://www.ExcelForum.com/ |
#7
|
|||
|
|||
Save single worksheet as new workbook
saveas "Z:\SecDept\Recommendations\" & Sheets("Tax40").Range("A10").Value & " " & strdate & ".xls"
You forgot a \ after the folder name -- Regards Ron de Bruin http://www.rondebruin.nl "GorillaBoze " wrote in message ... That works! Thanks Jeff I have a question though...why does it not work when I add another folder to the location? saveas "Z:\SecDept\Recommendations" & Sheets("Tax40").Range ("A10").Value & " " & strdate & ".xls" --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Open workbook at specific worksheet | Adam Price | General Discussion | 1 | June 19th, 2004 01:31 AM |
emailing single worksheet | Ken G. | General Discussion | 3 | June 18th, 2004 12:19 PM |
enter data in single worksheet, appear in multiple | munscher | Worksheet Functions | 5 | June 11th, 2004 04:18 PM |
Making a workbook always open on the same worksheet? | Frank Kabel | Worksheet Functions | 2 | April 21st, 2004 03:29 PM |
Emailing a Single Worksheet | fiset | Worksheet Functions | 0 | February 23rd, 2004 06:42 PM |