Hello,
I have many files that i want to merge into one workbook, the problem is that the files all have 3 worksheets and i would like to edit them before merging them into one.
I have used this vba code to copy every workbook into one:
I Have also used this macro to do the editing to the workbooks I want to merge:
Is there a way to combine these so that the vba would handle the copying and editing the files to one workbook?
I have many files that i want to merge into one workbook, the problem is that the files all have 3 worksheets and i would like to edit them before merging them into one.
I have used this vba code to copy every workbook into one:
VBA Code:
Sub MergeWorkbooks()
Dim FolderPath As String
Dim File As String
Dim i As Long
FolderPath = "C:\x"
File = Dir(FolderPath)
Do While File <> ""
Workbooks.Open FolderPath & File
ActiveWorkbook.Worksheets().Copy _
after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Workbooks(File).Close
File = Dir()
Loop
End Sub
I Have also used this macro to do the editing to the workbooks I want to merge:
Code:
Sub Börsdata()
'
' Börsdata Makro
'
'
Range("B13:C28").Select
Selection.Cut
Sheets("R12").Select
Range("N1").Select
ActiveSheet.Paste
Columns("N:N").EntireColumn.AutoFit
Columns("O:O").EntireColumn.AutoFit
Sheets("Info").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Quarter").Select
ActiveWindow.SelectedSheets.Delete
End Sub
Is there a way to combine these so that the vba would handle the copying and editing the files to one workbook?