View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Create a new Excel file with selected cells

hi,
here is a sub that i use to save ranges. select the range you want to save
to another file and run the macro. i have this in a personal menu.

Sub mac1SaveRange()

'Macro written by FSt1 4/27/02

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


"john" wrote:

Hi All,

I need your help once again. I have a Dashboard with five sheets and I
was wondering if there is a function to create a new Excel file based
on the data selected from the Dashboard.


I would like to select data or cells from different sheets from the
Dashboard then create a new Excel file with the data selected using a
macro or vb.


I guess I could just copy and paste the data from one file to another
but there are a large number of cells I need to select. I would like to

know if I could automate this process.


Thanks in advance.