LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Button to copy, save a sheet in a new file

hi
not sure if this is what you're after but you might be able to tweek it. i am an old time spreadsheet user. me and spread sheets go back to before windows.....before the mouse. i was a long time lotus user until my company decided to switch to excel. yuck. anyway this is a lotus feature i got use to called save range. in lotus it was a menu item. excel doesn't have it. so i had to write a macro in excel.
Sub mac1SaveRange()
'Macro written by FSt1 4/27/95
Dim cnt As Long
Dim cell As Range
On Error GoTo err1
MsgBox "You have selected range" & Selection.Address
If Selection.Cells.Count = 1 Then
If MsgBox("You have selected only one cell. Continue?????", vbYesNo, "Warning") = vbNo Then
Exit Sub
End If
End If
cnt = 0
For Each cell In Selection
If Not IsEmpty(cell) Then
cnt = cnt + 1
End If
Next
If cnt = 0 Then
If MsgBox("There is no data in the selected range. Continue?!?!?!?!?", vbYesNo, "Warning") = vbNo Then
Exit Sub
End If
End If
'ActiveSheet.UsedRange.Select
Selection.Copy
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
Application.Dialogs(xlDialogSaveAs).Show
err1:
MsgBox ("Need a range to save, diphead.")
Exit Sub
End Sub

i put some safety code to prevent me from trying to save an empty range or a single cell. you might want to change that. the code was designed to high light a range and save that range to a new workbook. i DO NOT RECOMMEND that you save a sheet with the safety code perticularly if using 07 or higher. you might be sitting there awhile while excel checks all the cells. you mentioned formulas... the code i wrote uses xlpasteall. you might want to change that to xlpastevalues. anyway look it over... tweek it as needed. i doubt that it will serve you as is. you mentioned a button. that is in the tool box. drop a button on the sheet and assign the finished macro to it. i sometimes use text boxes. six of one...half a dozen of the other. both work.

good luck
regards
FSt1
 
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
Button to copy, save a sheet in a new file JohnB[_5_] Excel Programming 2 May 10th 11 06:55 PM
Assigning a button to SAVE a sheet John Petranek[_2_] Excel Programming 2 March 14th 09 02:42 AM
save only active sheet Button. tim Excel Discussion (Misc queries) 7 May 23rd 08 11:27 PM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file [email protected] Setting up and Configuration of Excel 0 March 14th 07 02:13 AM
How to save a file without overwrite or save a copy? SettingChange Setting up and Configuration of Excel 1 November 3rd 05 02:10 AM


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