Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Comman Button to Save Worksheet as Workbook

OK, I would like to thank you all for making this such a valuable
resource.

Here is my question.

I need a macro that when I click on a command button it will save the
current worksheet (not the workbook) as a file based on the contents of
2 cells.

For example.

WorkSheet = 8

c9 = Name

d3 = Date

When you click on the button it will save Just the current worksheet
(8) as Name_Date.xls

Any help is greatly appreciated.

Thanks,

-T

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Comman Button to Save Worksheet as Workbook

I'd use a button from the forms toolbar that's assigned to this macro:

Option Explicit
Sub testme()

Dim NewName As String

With ActiveSheet
NewName = .Range("c9").Value & Format(.Range("d3"), "yyyymmdd") _
& ".xls"
.Copy 'to a new workbook
End With

With ActiveSheet.Parent 'that new workbook
.SaveAs Filename:=ThisWorkbook.Path & "\" & NewName, _
FileFormat:=xlWorkbookNormal
.Close savechanges:=False
End With

End Sub

Remember that the workbook name can't have those /'s in them--that's why I used
format.



tmstreet wrote:

OK, I would like to thank you all for making this such a valuable
resource.

Here is my question.

I need a macro that when I click on a command button it will save the
current worksheet (not the workbook) as a file based on the contents of
2 cells.

For example.

WorkSheet = 8

c9 = Name

d3 = Date

When you click on the button it will save Just the current worksheet
(8) as Name_Date.xls

Any help is greatly appreciated.

Thanks,

-T


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Comman Button to Save Worksheet as Workbook

Thanks so much.

I can fumble my way through formulas, but I need you 'real' excel
people to figure out the rest.

Your the man Dave.

Dave Peterson wrote:
I'd use a button from the forms toolbar that's assigned to this macro:

Option Explicit
Sub testme()

Dim NewName As String

With ActiveSheet
NewName = .Range("c9").Value & Format(.Range("d3"), "yyyymmdd") _
& ".xls"
.Copy 'to a new workbook
End With

With ActiveSheet.Parent 'that new workbook
.SaveAs Filename:=ThisWorkbook.Path & "\" & NewName, _
FileFormat:=xlWorkbookNormal
.Close savechanges:=False
End With

End Sub

Remember that the workbook name can't have those /'s in them--that's why I used
format.



tmstreet wrote:

OK, I would like to thank you all for making this such a valuable
resource.

Here is my question.

I need a macro that when I click on a command button it will save the
current worksheet (not the workbook) as a file based on the contents of
2 cells.

For example.

WorkSheet = 8

c9 = Name

d3 = Date

When you click on the button it will save Just the current worksheet
(8) as Name_Date.xls

Any help is greatly appreciated.

Thanks,

-T


--

Dave Peterson


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
mail merging 2 workbooks??? Bubba Gump Excel Discussion (Misc queries) 21 August 7th 06 09:13 AM
Customizing Worksheet Menu Bar for a workbook without VBA coding Sylvia Excel Discussion (Misc queries) 0 March 20th 06 07:20 AM
Copying A Worksheet From Each Open Workbook to an new Workbook carl Excel Worksheet Functions 1 January 3rd 06 05:37 PM
How can I create a button to save one worksheet into a new workshe court Excel Discussion (Misc queries) 2 July 6th 05 06:39 PM
Help - now really stuck! File transfer problem ohboy! Excel Discussion (Misc queries) 10 May 2nd 05 09:07 PM


All times are GMT +1. The time now is 04:10 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"