I know that maybe someone else asked you something similar. However, I have not been able to find the specific solution to my problem. That’s why I ask for your help, hoping you can support me.
Below I summarize what I would like to do through a macro with OOo basic:
- The files will be stored in a directory, a several Origin and only one Destination Files.
I imagine that for convenience the macro could be executed in the same directory where the files are located, no matter what. As the following vba lines:
Folder = ActiveWorkbook.Path & "\"
nFile = 1
Filename = Dir(Folder & "RVTools_" & "*.xl*")
'...
'More loop to go file by file. With the intention of copying the selected columns of different sheets in workbook from the file originA to the first sheet of destinationA.
'As:
Do while file <> ""
Workbooks.Open
For each sheet in Workbooks(file).Worksheets
allsheets = Workbooks(OriginX).Worksheets.Count
Next file
Workbooks(file).close
File = Dir()
Loop
- Each source file will have several columns per sheet and several sheets per workbook. Type the following vba lines:
As:
Workbooks(File).Worksheets(Sheet.Name).Copy after:=Workbooks(OriginX).Worksheets(allsheets)
- Copy the contents of some columns of the different sheets of the OriginA, OriginB, OriginC, etc,. workbooks to the Destination file.
OriginA multiple sheets → Destination Sheet1
OriginB multiple sheets → Destination Sheet2
OriginN multiple sheets → Destination SheetN
Thanks again and I hope someone has an idea of how to solve this problem, because I’m lost.