ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to merge open workbooks (https://www.excelbanter.com/excel-programming/371259-macro-merge-open-workbooks.html)

Barry McConnell

Macro to merge open workbooks
 
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry


Ron de Bruin

Macro to merge open workbooks
 
See your other thread

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry




Barry McConnell

Macro to merge open workbooks
 
My intranet won't let me access that site. Can you please give me the code Ron?

"Ron de Bruin" wrote:

See your other thread

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry





Ron de Bruin

Macro to merge open workbooks
 
See Misc group where you also post
Please use one group

Copy this macro in a new workbook and run it
Or do you want to use it in your personal.xls

Sub test()
Dim wb As Workbook
For Each wb In Application.Workbooks
If wb.Windows(1).Visible And wb.Path < "" And wb.Name < ThisWorkbook.Name Then
wb.Worksheets.Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Cou nt)
End If
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
My intranet won't let me access that site. Can you please give me the code Ron?

"Ron de Bruin" wrote:

See your other thread

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry







Tom Ogilvy

Macro to merge open workbooks
 
Basic code would be:

Sub CopySheets()
Dim bk As Workbook, bk1 As Workbook
Set bk = Workbooks.Add()
For Each bk1 In Application.Workbooks
If bk1.Windows(1).Visible Then
Application.DisplayAlerts = False
bk1.Worksheets.Copy After:=bk.Worksheets(bk.Worksheets.Count)
Application.DisplayAlerts = True
End If
Next
End Sub


--
Regards,
Tom Ogilvy


"Barry McConnell" wrote:

My intranet won't let me access that site. Can you please give me the code Ron?

"Ron de Bruin" wrote:

See your other thread

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry





Barry McConnell

Macro to merge open workbooks
 
Yeah sorry, posted in general by mistake.

Think this works. Thank you very much for your help.

"Ron de Bruin" wrote:

See Misc group where you also post
Please use one group

Copy this macro in a new workbook and run it
Or do you want to use it in your personal.xls

Sub test()
Dim wb As Workbook
For Each wb In Application.Workbooks
If wb.Windows(1).Visible And wb.Path < "" And wb.Name < ThisWorkbook.Name Then
wb.Worksheets.Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Cou nt)
End If
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
My intranet won't let me access that site. Can you please give me the code Ron?

"Ron de Bruin" wrote:

See your other thread

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Barry McConnell" wrote in message
...
Is there a small macro that will take all the worksheets from all open
workbooks and put them in one new consolidated workbook?

Thanks

Barry









All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com