MaunishP
Member
Hi Team,
I already have a code which is able to consolidate multiple workbooks into one sheet, however it only copies data from 1st worksheet, but i want to copy all data from worksheet 2.
Naming structure for each workbooks for worksheet 2 will not be same.
Please help where i can consolidate data from each workbook only 2nd worksheet.
Here goes current code
I already have a code which is able to consolidate multiple workbooks into one sheet, however it only copies data from 1st worksheet, but i want to copy all data from worksheet 2.
Naming structure for each workbooks for worksheet 2 will not be same.
Please help where i can consolidate data from each workbook only 2nd worksheet.
Here goes current code
Code:
Option Explicit
Sub OpenImp() 'Excel VBA to open and import data
Const sPath = "M:\Maunish Project\test\" 'Change to suit
Dim sFil As String
Dim owb As Workbook
Dim ws As Worksheet
Set ws = Sheet1
sFil = Dir(sPath & "*.xl*") 'Flexible enough to handle all XL file types
Do While sFil <> "" 'Only Copies Cols B
Set owb = Workbooks.Open(sPath & sFil)
[A1:L30000].Copy ws.Range("A" & Rows.Count).End(xlUp)(2)
owb.Close False 'Close No need to save
sFil = Dir
Loop
End Sub