Forum Discussion
Gestcoaubin
Sep 13, 2021Copper Contributor
several tabs grouped together in a different file and updated automatically
Hello, I have several datasheets with a single tab each that I would like to see grouped into a master file where the data would be updated automatically. Basically, on my computer in each folder...
- Sep 13, 2021
To be honest, I would suggest you use power query
But as you mentioned, you want to check the content of each file ("tab") on a master file.
There is a manual way, but I guess you can play with vba coding.
Ps.: For your safety, make a Copy of the original folder before you run the code below.
Sub ConslidateWorkbooks() Dim FolderPath As String Dim Filename As String Dim Sheet As Worksheet Application.ScreenUpdating = False FolderPath = Environ("userprofile") & "DesktopTest" Filename = Dir(FolderPath & "*.xls*") Do While Filename <> "" Workbooks.Open Filename:=FolderPath & Filename, ReadOnly:=True For Each Sheet In ActiveWorkbook.Sheets Sheet.Copy After:=ThisWorkbook.Sheets(1) Next Sheet Workbooks(Filename).Close Filename = Dir() Loop Application.ScreenUpdating = True End Sub
Gestcoaubin
Sep 13, 2021Copper Contributor
Thank you ! I don't master the coding very well. Can you help me with the manual way ?
Juliano-Petrukio
Sep 13, 2021Bronze Contributor
replace Environ("userprofile") & "DesktopTest" with your folder address
Example:
"C:\Users\luthi\Documents"
FolderPath="C:\Users\luthi\Documents"
Example:
"C:\Users\luthi\Documents"
FolderPath="C:\Users\luthi\Documents"