VBA Code--------!
Hi Thyagaraj,
Can Anybody provide with the vba code for merging all the
worksheets of all the open workbooks.
Ie; all the open workbooks' sheets should be moved to one
neew workbook.
Try something like:
'=============
Public Sub MergeBooks()
Dim destWb As Workbook
Dim WB As Workbook
Dim SH As Worksheet
Dim i As Long
Dim sstr As String
Const sName As String = "My Summary"
sstr = Trim(sName) & " " & Format(Date, "yyyymmdd")
Set destWb = Workbooks.Add(xlWBATWorksheet)
Set SH = destWb.Worksheets(1)
SH.Name = "Summary"
Application.ScreenUpdating = False
With destWb
For Each WB In Application.Workbooks
If WB.Name < .Name _
And UCase(WB.Name) < "PERSONAL.XLS" Then
i = i + 1
WB.Worksheets.Copy after:=.Sheets(.Sheets.Count)
SH.Cells(i, "A").Value = WB.Name
SH.Cells(i, "B").Value = WB.Worksheets.Count
End If
Next WB
End With
destWb.SaveAs Filename:=sstr, _
FileFormat:=xlWorkbookNormal
Application.ScreenUpdating = True
End Sub
'<<=============
---
Regards,
Norman
"Thyagaraj" wrote in message
oups.com...
Dear Friends,
Can Anybody provide with the vba code for merging all the worksheets of
all the open workbooks.
Ie; all the open workbooks' sheets should be moved to one neew
workbook.
Is this possible.
Regards
Thyagaraj
|