Thanks Devendra, I will send you some sample files for better understanding my requirements. Thanks again for your help. Sent from my BlackBerry 10 smartphone.
Hi Sandeep, I am sharing the code, If any group member can modify the code according to you, would be helpful. ** If we can assign few header names, of which data we want to extract from the workbooks. It would be relevant. Code ------------ Sub Merge_Files() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Dim i As Long Dim col_no As Long, row_no As Long Dim arr_ws As Variant Dim ws1 As Worksheet, wb1 As Workbook Dim col_ws1 As Long, row_ws1 As Long Set wb1 = ThisWorkbook Set ws1 = ActiveSheet Set d = Application.FileDialog(msoFileDialogFolderPicker) d.Show fldpath = d.SelectedItems(1) & "\" 'Create an instance of the FileSystemObject Set objFSO = CreateObject("Scripting.FileSystemObject") 'Get the folder object Set objFolder = objFSO.GetFolder(fldpath) i = 0 'loops through each file in the directory and prints their names and path For Each objFile In objFolder.Files Debug.Print objFile i = i + 1 Workbooks.Open FileName:=objFile row_no = ActiveSheet.Range(Cells(Rows.Count, 1), Cells(Rows.Count, 1)).End(xlUp).Row col_no = ActiveSheet.Range(Cells(1, Columns.Count), Cells(1, Columns.Count)).End(xlToLeft).Column arr_ws = ActiveSheet.Range(Cells(1, 1), Cells(row_no, col_no)) ActiveWorkbook.Close savechanges = no ws1.Activate If ws1.Range("A1").Value <> "" Then row_ws1 = ActiveSheet.Range(Cells(Rows.Count, 1), Cells(Rows.Count, 1)).End(xlUp).Row + 1 col_ws1 = ActiveSheet.Range(Cells(1, Columns.Count), Cells(1, Columns.Count)).End(xlToLeft).Column Else row_ws1 = 1 col_ws1 = 1 End If ws1.Range(Cells(row_ws1, 1), Cells(row_ws1 + row_no - 1, col_no)) = arr_ws Next objFile End Sub On Wed, Jan 27, 2016 at 2:19 PM, Sandeep Chhajer <chhajersand...@gmail.com> wrote:
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. |
- $$Excel-Macros$$ Merge multiple Workbook Sandeep Chhajer
- Fw: $$Excel-Macros$$ Merge multiple Workbook Sandeep Chhajer
- Re: Fw: $$Excel-Macros$$ Merge multiple Workbook Devendra Sahay
- Re: $$Excel-Macros$$ Merge multiple Workbook Sandeep Chhajer
- Re: $$Excel-Macros$$ Merge multiple Workb... Devendra Sahay
- Re: $$Excel-Macros$$ Merge multiple ... Sandeep Chhajer