Create a new Excel file with selected cells

J

john

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.
 
G

Guest

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
 
J

john

Hi,

Thanks for your help. The Macro works great.

Is it possible to select multiple ranges from multiple sheets then
create the new Excel file?


Thanks for your help.

Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top