Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
EAHRENS
 
Posts: n/a
Default I want a macro to save a workbook as a user inputted cell

I want to use a macro to automatically save a workbook as a name the user
will be required to enter into a cell. How can i do this?
  #2   Report Post  
Alan
 
Posts: n/a
Default I want a macro to save a workbook as a user inputted cell

To save the file and call it whatever is in Sheet1, range A1 try,
Sub SaveAsCellValue()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" & Sheet1.Range("A1") &
".xls"
End Sub
Change the file path to suit,
Regards,
Alan,
"EAHRENS" wrote in message
...
I want to use a macro to automatically save a workbook as a name the user
will be required to enter into a cell. How can i do this?



  #3   Report Post  
EAHRENS
 
Posts: n/a
Default I want a macro to save a workbook as a user inputted cell

I pasted that in nad changed sheet1 to intro and range a1 to F8 and got a
syntax error message. I pastet it as follows:
Sub saveas()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" & Intro.Range("F8") &
".xls"
End Sub



"Alan" wrote:

To save the file and call it whatever is in Sheet1, range A1 try,
Sub SaveAsCellValue()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" & Sheet1.Range("A1") &
".xls"
End Sub
Change the file path to suit,
Regards,
Alan,
"EAHRENS" wrote in message
...
I want to use a macro to automatically save a workbook as a name the user
will be required to enter into a cell. How can i do this?




  #4   Report Post  
Alan
 
Posts: n/a
Default I want a macro to save a workbook as a user inputted cell

Try this, there are four lines of code here, the third line that starts
with "C:\Documents..... etc and ends with & ".xls" is all one line, I think
the text is getting wrapped in the e-mail, you need to edit it back to one
line only.

You can't use Intro.Range("F8"), it needs to be Sheets("Intro").Range("F8")
if you want to refer to the name you've given the sheet.
Where I put Sheet1.Range("A1"), that refers to the name of the sheet within
the VB editor, you'll see Sheet1 (Intro) or whatever sheet it is on the top
left of the window. By referring to Sheet1. it will always refer to that
sheet even if you rename that sheet to something else. I always use this
method because unlike a formula in a worksheet, the code wont automatically
change if you rename the sheet as a formula will and its a bit tedious to
have to alter the code if there's a lot of it,
Regards,
Alan.

Sub Saveas ()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" &
Sheets("Intro").Range("F8") & ".xls"
End Sub

"EAHRENS" wrote in message
...
I pasted that in nad changed sheet1 to intro and range a1 to F8 and got a
syntax error message. I pastet it as follows:
Sub saveas()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" & Intro.Range("F8") &
".xls"
End Sub



"Alan" wrote:

To save the file and call it whatever is in Sheet1, range A1 try,
Sub SaveAsCellValue()
ThisWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Owner\My Documents\" & Sheet1.Range("A1") &
".xls"
End Sub
Change the file path to suit,
Regards,
Alan,
"EAHRENS" wrote in message
...
I want to use a macro to automatically save a workbook as a name the
user
will be required to enter into a cell. How can i do this?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
Linking a cell to another workbook cell based on a variable name Brian Excel Discussion (Misc queries) 6 June 1st 05 11:54 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
How to save Excel macro using name contained in cell? CG Excel Worksheet Functions 1 February 3rd 05 03:51 PM
This one is tricky....Macro to save file as cell value x in di Andy Excel Discussion (Misc queries) 4 November 26th 04 08:52 AM


All times are GMT +1. The time now is 04:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"