Merge wbs to Master wb - Control the startup message about updating linked workbooks and copy only values not formulas

I have to copy data wbs to a master wb. The simple macro below works fine.

Q1: First, in the Data wbs there are  links to another wbs. I don't know how to control the startup message about updating linked workbooks in Excel when I run the macro. I have changed the Excel Options to avoid the message but  no better result. How can I change the macro that it copies from closed data wbs?

Q2:  Second, I would like copy only the values, no formulars to the master wb.
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial


Sub simpleXlsMerger()
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
 
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder("C:\Users\Adam\Desktop\Verbundaktion\")
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Set bookList = Workbooks.Open(everyObj)
 
Range("A3:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
 
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
bookList.Close
Next
End Sub

Open in new window


Thank you.

Regards,

Adam

Source
Adam ElsheimerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsDistinguished Expert - 2017Commented:
Hi Adam,

Please try below:
Sub simpleXlsMerger()
Dim bookList As Workbook
Dim LR As Long
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
 
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder("C:\Users\Adam\Desktop\Verbundaktion\")
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
Set bookList = Workbooks.Open(everyObj)
Application.AskToUpdateLinks = True
Application.DisplayAlerts = True

Range("A3:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
LR = Worksheets(1).Range("A" & Rows.Count).End(xlUp).Row
Worksheets(1).Range("A" & LR + 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
bookList.Close
Next
End Sub

Open in new window

1
Adam ElsheimerAuthor Commented:
Shums, many thanks for your uncomplicated help.

Update Message and paste works fine.  I get know the save messagebox. I am so sorry to forget to mention this in my description.

Unbenannt.JPG
Regards,

Adam
0
ShumsDistinguished Expert - 2017Commented:
no problem, try below:
Sub simpleXlsMerger()
Dim bookList As Workbook
Dim LR As Long
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
 
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder("C:\Users\Adam\Desktop\Verbundaktion\")
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
Set bookList = Workbooks.Open(everyObj)
Application.AskToUpdateLinks = True
Application.DisplayAlerts = True

Range("A3:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Worksheets(1).Activate
LR = Worksheets(1).Range("A" & Rows.Count).End(xlUp).Row
Worksheets(1).Range("A" & LR + 1).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.DisplayAlerts = False
bookList.Close
Application.DisplayAlerts = True
Next
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Adam ElsheimerAuthor Commented:
Sorry, one issue more.

Q: Can the macro overwrite the existing values please. When I update the Master file I get Duplicates.

Unbenannt.JPG
Thanks

Regards,

Adam
0
ShumsDistinguished Expert - 2017Commented:
Sorry Adam this is different issue, I need to write new code.
0
Adam ElsheimerAuthor Commented:
Shums, many thanks for your very fast and uncomplicated help.

Regards,

Adam
0
ShumsDistinguished Expert - 2017Commented:
You're Welcome Adam! Please to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.