![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 211
|
Many thanks to all the people who have helped so far. I am nearly at the end of my project now, just a few details to iron out.
What I want to do is save the sheet I am working on as separate workbook under the name of the contents of one of the cells, E8. Many Thanks in anticipation! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,388
|
Maybe with a line of code like this?
ActiveWorkbook.SaveAs ("C:YourFilePath" & Sheet1.Range("E8").Value & ".xls") |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub Macro1() Dim sNewWb As String sNewWb = Sheets("yoursheet").Range("A8").Text ActiveSheet.Copy On Error GoTo ErrSave With ActiveWorkbook .SaveAs sNewWb .Close End With Exit Sub ErrSave: MsgBox "While trying to save: " & sNewWb & vbCr & _ Err.Number & ":=" & Err.Description End Sub |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: May 2002
Posts: 211
|
Tom, thanks forthe reply.
It works but it saves all the sheets in the workbook, I want to save only sheet1 Can you help |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Posts: 211
|
Ivan, thanks very much for your effort,
unfortunately an error message comes up at the end, but it does save the worrksheet 1, but as, say, book2 etc |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|