This is great information. Is there a simple way to edit this to consolidate the worksheets into one workbook, creating a separate tab for each consolidated worksheet, instead of all data on one sheet? Thanks in advance...
This is great information. Is there a simple way to edit this to consolidate the worksheets into one workbook, creating a separate tab for each consolidated worksheet, instead of all data on one sheet? Thanks in advance...
What is great information ? A simple way to edit what ?
Before we can help you out you will have to give us some more information about what you want to achieve.
Hi
Untested.
Code:Option Explicit Sub kTest() Dim SourceFolder As String Dim wbkSource As Workbook Dim wbkDest As Workbook Dim FName As String Dim rngSource As Range Dim wksDest As Worksheet SourceFolder = "C:\Test" '<<< adjust the folder If Right$(SourceFolder, 1) <> "\" Then SourceFolder = SourceFolder & "\" FName = Dir(SourceFolder & "*.xls*") Set wbkDest = ThisWorkbook Application.ScreenUpdating = 0 Set wksDest = wbkDest.Worksheets(wbkDest.Worksheets.Count) Do While Not FName = vbNullString If Not FName = wbkDest.Name Then Set wbkSource = Workbooks.Open(SourceFolder & FName, 0) Set rngSource = wbkSource.Worksheets(1).Range("a1").CurrentRegion Set wksDest = wbkDest.Worksheets.Add(, wksDest) rngSource.Copy wksDest.Range("a1") wksDest.Name = FName End If wbkSource.Close 0 Set wbkSource = Nothing FName = Dir() Loop Application.ScreenUpdating = 1 End Sub
Cheers !
Excel Range to BBCode Table
Use Social Networking Tools If You Like the Answers !
Message to Cross Posters
@ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)
@ bakerman,
The OP was refering thread - http://www.excelfox.com/forum/f13/co...-file-vba-569/
Cheers !
Excel Range to BBCode Table
Use Social Networking Tools If You Like the Answers !
Message to Cross Posters
@ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)
Bookmarks