Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pete
 
Posts: n/a
Default Copy sheet to a new file

Is it possible to have a button on a worksheet which
would output an excel file or a word file with just that
sheets information on it?

A lot of the cells contain formaulas.

Also how can I get the button to call the file by the
worksheet tab name
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe something like:

Option Explicit
Sub testme01()

Dim newWks As Worksheet

ActiveSheet.Copy 'to a new workbook
Set newWks = ActiveSheet 'in that new workbook

With newWks
.Buttons.Delete
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\" & .Name & ".xls", _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
End Sub



Pete wrote:

Is it possible to have a button on a worksheet which
would output an excel file or a word file with just that
sheets information on it?

A lot of the cells contain formaulas.

Also how can I get the button to call the file by the
worksheet tab name


--

Dave Peterson
  #3   Report Post  
Pete
 
Posts: n/a
Default

Dave,

It is great, the filename layout works just right. The
sheet contains formulas though and they are linked. I
need to be able to send the file by email to someone
without security access to the main file. The values
need to be there and not an option to update values.

Thanks.

Pete

-----Original Message-----
Maybe something like:

Option Explicit
Sub testme01()

Dim newWks As Worksheet

ActiveSheet.Copy 'to a new workbook
Set newWks = ActiveSheet 'in that new workbook

With newWks
.Buttons.Delete
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\"

& .Name & ".xls", _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
End Sub



Pete wrote:

Is it possible to have a button on a worksheet which
would output an excel file or a word file with just

that
sheets information on it?

A lot of the cells contain formaulas.

Also how can I get the button to call the file by the
worksheet tab name


--

Dave Peterson
.

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could do a copy|paste special|values (in code) or something like this

Option Explicit
Sub testme01()

Dim newWks As Worksheet

ActiveSheet.Copy 'to a new workbook
Set newWks = ActiveSheet 'in that new workbook

With newWks
.Buttons.Delete
With .UsedRange
.Value = .Value
End With
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\" & .Name & ".xls", _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
End Sub

With .UsedRange
.Value = .Value
End With

could be:

.Cells.Copy
.Cells.PasteSpecial Paste:=xlPasteValues

Depending on how you feel <bg.


Pete wrote:

Dave,

It is great, the filename layout works just right. The
sheet contains formulas though and they are linked. I
need to be able to send the file by email to someone
without security access to the main file. The values
need to be there and not an option to update values.

Thanks.

Pete

-----Original Message-----
Maybe something like:

Option Explicit
Sub testme01()

Dim newWks As Worksheet

ActiveSheet.Copy 'to a new workbook
Set newWks = ActiveSheet 'in that new workbook

With newWks
.Buttons.Delete
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\"

& .Name & ".xls", _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
End Sub



Pete wrote:

Is it possible to have a button on a worksheet which
would output an excel file or a word file with just

that
sheets information on it?

A lot of the cells contain formaulas.

Also how can I get the button to call the file by the
worksheet tab name


--

Dave Peterson
.


--

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
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM
Copy formula...sheet 2 sheet Mick New Users to Excel 0 January 26th 05 01:58 AM
Is it possible to recover a deleted sheet after saving the file? RoseM Excel Discussion (Misc queries) 1 January 25th 05 03:04 PM
Hyperlink to specific sheet in Excel Web File jd17 Links and Linking in Excel 0 December 8th 04 09:03 PM
Naming & renaming a sheet tab Cgbilliar Excel Worksheet Functions 1 November 7th 04 05:57 PM


All times are GMT +1. The time now is 05:28 PM.

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

About Us

"It's about Microsoft Excel"