#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default macro to save as

I want to create a macro to get the contents of a cell of a specific sheet,
open save as dialog and using the contents of that cell as the new filename,
to save only the current sheet.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default macro to save as

Try something along these lines. Press Alt+F11 and select INSERT from the
menu and select MODULE:

Sub CopyWS()

Dim strName As String
Dim ws As Worksheet

'Change range to the cell that contains the new filename

strName = Range("A1").Value
Set ws = ThisWorkbook.Sheets(1)
Application.Workbooks.Add
ws.Copy befo=ActiveWorkbook.Sheets(1)
ActiveWorkbook.SaveAs strName

Set ws = Nothing

End Sub

--
Kevin Backmann


"frageo64" wrote:

I want to create a macro to get the contents of a cell of a specific sheet,
open save as dialog and using the contents of that cell as the new filename,
to save only the current sheet.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default macro to save as

Kevin thank you very much for your help. Can I take it a lilltle bit further
and instead of copying a sheet can I copy a range of cells?

"Kevin B" wrote:

Try something along these lines. Press Alt+F11 and select INSERT from the
menu and select MODULE:

Sub CopyWS()

Dim strName As String
Dim ws As Worksheet

'Change range to the cell that contains the new filename

strName = Range("A1").Value
Set ws = ThisWorkbook.Sheets(1)
Application.Workbooks.Add
ws.Copy befo=ActiveWorkbook.Sheets(1)
ActiveWorkbook.SaveAs strName

Set ws = Nothing

End Sub

--
Kevin Backmann


"frageo64" wrote:

I want to create a macro to get the contents of a cell of a specific sheet,
open save as dialog and using the contents of that cell as the new filename,
to save only the current sheet.

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 SAVE HELP DP7 Excel Worksheet Functions 2 October 17th 07 08:01 PM
save as macro henrik Excel Discussion (Misc queries) 1 July 22nd 07 03:58 PM
Save As Macro el zorro[_2_] Excel Discussion (Misc queries) 3 July 18th 07 12:28 AM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
Macro to save John Excel Worksheet Functions 2 April 29th 05 12:38 AM


All times are GMT +1. The time now is 04:16 AM.

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"