A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
ok,
you have 10 sheets
do you want to export all data (10 sheets)
in a new workbook in one sheet ?
(values and formats only?)
if so, try this..
The code below, creates a new workbook (1 sheet)
workbook name is 'Report' and sheet1 name is 'ALL DATA'
(copy/paste values and formats)
and SaveAs in same folder as 'Source' workbook.
Sub abc()
Dim myWB As Workbook, WB As Workbook
Dim r As Long, N As Long, i As Integer
Dim myPath As String
Set myWB = ThisWorkbook
Application.ScreenUpdating = False
myPath = ThisWorkbook.Path & ""
Set WB = Workbooks.Add
For i = WB.Sheets.Count To 2 Step -1
Application.DisplayAlerts = False
Sheets(i).Delete
Application.DisplayAlerts = True
Next i
WB.Sheets(1).Name = "ALL DATA"
N = 1
On Error Resume Next
For i = 1 To myWB.Sheets.Count
r = myWB.Sheets(i).Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
myWB.Sheets(i).Rows("1:" & r).Copy
Cells(N, 1).PasteSpecial xlValues
Cells(N, 1).PasteSpecial xlFormats
Application.CutCopyMode = False
N = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 2
Next
Application.DisplayAlerts = False
WB.SaveAs (myPath & "Report.xls")
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "Workbook ""Report"" has been updated"
WB.Close
End Sub
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxx
and..
in ThisWorkbook write:
Private Sub Workbook_Open()
Run "abc"
End Sub