View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Saving Active Worksheet

hi
here is a personal macro i wrote some time back. saves a selected range from
an entire sheet(select the sheet) to a single cell (you get a warning if
saving a single cell). adjust to suit. work in 97 to 03. untested in 07.
Sub mac1SaveRange()
'Macro written by FSt1 4/27/98
Dim cnt As Long
Dim cell As Range
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
End Sub

warning: some lines wraped.

Regards
FSt1

"ypukpete" wrote:

I want to save only the active worksheet in a workbook using a command button.
I need the Save As screen to appear so that I can send it to the folder I
require at the time and also give the worksheet a new name, but let me know
if it is invalid. Probably easy when you know how.
I am using excel 2000. Any assistance appreciated
--
ypukpete