Clairexcel
New Member
- Joined
- Mar 23, 2021
- Messages
- 31
- Office Version
- 2016
- 2010
Hello everyone,
I have a VBA code that copies all the data from all the workbooks existing in the folder and pastes them in the Masterbook (which has to be in the same folder).
It worked fine at first, thank to some adjustments/help I got from this forum, but now, it only copies the data from the workbook sitting right below it (below the master book), and does not copy the data from the other three workbooks in the folder. This is very strange.
1. The code is in the Masterbook, in a module
2. The workbooks, Master wkbk included, are in xlsb (binary format), while at first when I got this code they were xlsm (but it worked fine a xlsb too)
3. There are named ranges in the workbooks (I don't think this could be an issue)
This is the code I have, any help will be highly appreciated, as I already installed it at work place and it worked fine but now it doesn't copy all the workbooks anymore. ..Please help.
I have a VBA code that copies all the data from all the workbooks existing in the folder and pastes them in the Masterbook (which has to be in the same folder).
It worked fine at first, thank to some adjustments/help I got from this forum, but now, it only copies the data from the workbook sitting right below it (below the master book), and does not copy the data from the other three workbooks in the folder. This is very strange.
1. The code is in the Masterbook, in a module
2. The workbooks, Master wkbk included, are in xlsb (binary format), while at first when I got this code they were xlsm (but it worked fine a xlsb too)
3. There are named ranges in the workbooks (I don't think this could be an issue)
This is the code I have, any help will be highly appreciated, as I already installed it at work place and it worked fine but now it doesn't copy all the workbooks anymore. ..Please help.
VBA Code:
Sub Update_allwkbks()
Dim wb As String
Application.ScreenUpdating = False
ThisWorkbook.Worksheets("Aggiorna le pratiche").UsedRange.Offset(1, 0).ClearContents
wb = Dir(ThisWorkbook.Path & "\*")
Do Until wb = ""
If wb <> ThisWorkbook.Name Then
Workbooks.Open ThisWorkbook.Path & "\" & wb
With Workbooks(wb).Sheets(1)
.UsedRange.Offset(1).Copy ThisWorkbook.Sheets("Aggiorna le pratiche").Cells(Rows.Count, 1).End(xlUp).Offset(1)
End With
Application.CutCopyMode = False
Workbooks(wb).Close False
End If
wb = Dir
Loop
Application.ScreenUpdating = True
End Sub